Startup Weekend!

 

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)

THEM!!!!

54 hours!

 

125 people++ 

 

Thousands of $$ in prizes!!!

 

Going on to global championship!!!

US!!!!!

Many many minutes!

 

ALLLL of US! :) 

 

No money whatsoever, but a lot of fun!!!!

 

hmmm... Contracts with Purpose Social?!

 

TONIGHT!!!!

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

Managing our Data!

 

Node, Mongo, Express on our back-end (server)

Front-end set up with plumbing for HTTP verbs!

 

  • GET - Requests data from a specified resource
  • POST - Submits data to be stored/processed to a specified resource

 

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>

Mongo?  a bit of a leap but consistent with our view so far...

  • it CAN Be quieried!!!   you don't have to always bring an entire collection across the plumbing!
  • Binary SON (not exactly JSON but close, a little more efficient!)...
  • For example, a bank
    • each person has a
      • name, first and last
      • how long they have been a customer
      • list of accounts (embedded documents!)
    • root level is person...

what is a query?

  • we are all searching for something! :) 
  • need to ask about the values of a key
    • all documents and embedded documents are key:value pairs!
    • every document has a unique _id!
  • can even use some built in geographical help (GeoJSON) to find out like if things are close
  • also there are data objects of type date!!!

 

 

Package managers

  • chocolately
  • homebrew

 

run mongo and it connects to the deamon running at the default port "connecting to the db" (test)

 

DEMO(LITION?!)

 

http://node-js-133758.nitrousapp.com:3000/

Made with Slides.com