Vancouver: 2 grade 11 students
attachement for cutlery/chopsticks
detecting allergens, toxins and nutrition!!!!
(http://bcic.ca/blog/2015/swvan-winners-go-to-global-startup-battle?utm_content=buffer27f18&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer)
54 hours!
125 people++
Thousands of $$ in prizes!!!
Going on to global championship!!!
Many many minutes!
ALLLL of US! :)
No money whatsoever, but a lot of fun!!!!
hmmm... Contracts with Purpose Social?!
Bringing it all together... THE FULL STACK!!!!
Putting it all to work... Heather, the city, and the BIG DATA SUMMIT (March 2016)!
Showcasing some creations!
Pitching in the general direction of the next steps!
GAME ON!!!
Text
https://eljeejavier.files.wordpress.com/2013/03/matrix_wallpaper_by_dodopod-png.jpeg
Node, Mongo, Express on our back-end (server)
Front-end set up with plumbing for HTTP verbs!
JSON for the data format exchanged (BSON for the stored data in MongoDB)...
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.urlencoded({extended:true}));
var quotes = [
{ author : 'Audrey Hepburn', text : "Nothing is impossible, the word itself says 'I'm possible'!"},
{ author : 'Walt Disney', text : "You may not realize it when it happens, but a kick in the teeth may be the best thing in the world for you"},
{ author : 'Unknown', text : "Even the greatest was once a beginner. Don't be afraid to take that first step."},
{ author : 'Neale Donald Walsch', text : "You are afraid to die, and you're afraid to live. What a way to exist."}
];
app.get('/', function(req, res) {
res.json(quotes);
});
app.get('/quote/random', function(req, res) {
var id = Math.floor(Math.random() * quotes.length);
var q = quotes[id];
res.json(q);
});
app.get('/quote/:id', function(req, res) {
if(quotes.length <= req.params.id || req.params.id < 0) {
res.statusCode = 404;
return res.send('Error 404: No quote found');
}
var q = quotes[req.params.id];
res.json(q);
});
app.post('/quote', function(req, res) {
if(!req.body.author ||
!req.body.text) {
res.statusCode = 400;
return res.send('Error 400: Post syntax incorrect.');
}
var newQuote = {
author : req.body.author,
text : req.body.text
};
quotes.push(newQuote);
res.json(true);
});
app.listen(process.env.PORT || 3000);
<!DOCTYPE html>
<html lang="en">
<body>
<form action="http://node-js-133758.nitrousapp.com:3000/quote" method="post">
<input name="author" value="me">
<input name="text" value="hi">
<button>Send my quote</button>
</form>
</body>
</html>
run mongo and it connects to the deamon running at the default port "connecting to the db" (test)
http://node-js-133758.nitrousapp.com:3000/