// Load the http module to create an http server.
var http = require('http');
 
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.end("Hello World\n");
});
 
// Listen on port 8000, IP defaults to 127.0.0.1
server.listen(8000);
 
// Put a friendly message on the terminal
console.log("Server running at http://127.0.0.1:8000/");

@@ -1,423 +1,2190 @@
-// Load the http module to create an http server.%0Avar http = require('http');%0A %0A// Configure our HTTP server to respond with Hello World to all requests.%0Avar server = http.createServer(function (request, response) %7B%0A  response.writeHead(200, %7B%22Content-T
+    // set up ========================%0A    var express = require('express');%0A    var app = express();                              // create our app w/ express%0A    var mongoose = require('mongoose');               // mongoose for mongodb%0A    var morgan = require('morgan');                   // log requests to the console (express4)%0A    var bodyParser = require('body-parser');          // pull information from HTML POST (express4)%0A    var methodOverride = require('method-override');  // simulate DELETE and PUT (express4)%0A%0A    // configuration =================%0A    mongoose.connect('mongodb://localhost/test');     // connect to mongoDB database%0A%0A    // define model =================%0A    var DeezerAccount = mongoose.model('DeezerAccount', %7B%0A        accessToken: String,%0A        expire: String,%0A        userID: String%0A    %7D);%0A%0A    app.use(express.static(__dirname + '/public'));                 // set the static files location /public/img will be /img for users%0A    app.use(morgan('dev'));                                         // log every request to the console%0A    app.use(bodyParser.urlencoded(%7B'extended':'true'%7D));            // parse application/x-www-form-urlencoded%0A    app.use(bodyParser.json());                                     // parse application/json%0A    app.use(bodyParser.json(%7B t
 ype
-%22
 : 
-%22text/plain%22%7D);%0A  response.end(%22Hello World%5Cn%22);%0A%7D);%0A %0A// Listen on port 8000, IP defaults to 127.0.0.1%0Aserver.listen(8000);%0A %0A// Put a friendly messa
+'application/vnd.api+json' %7D)); // parse application/vnd.api+json as json%0A    app.use(methodOverride());%0A%0A    // routes ---------------------------------------------------------------------%0A    // get all stored accounts%0A    app.get('/api/accounts', function(req, res) %7B%0A%0A        // use mongoose to get all accounts in the database%0A        DeezerAccount.find(function(err, accounts) %7B%0A%0A            // if there is an error retrieving, send the error. nothing after res.send(err) will execute%0A            if (err)%0A                res.send(err)%0A%0A            res.json(accounts); // return all accounts in JSON format%0A        %7D);%0A    %7D);%0A%0A    // application -------------------------------------------------------------%0A    app.get('*', function(req, res) %7B%0A        res.sendfile('./public/index.html'); // load the single view file (angular will handle the page chan
 ge
+s
  on the 
 term
@@ -2183,70 +2183,186 @@
 the 
-terminal%0Aconsole.log(%22Server running at http://127.0.0.1:
+front-end)%0A    %7D);%0A%0A    // listen (start app with node server.js) ======================================%0A    app.listen(8000);%0A    console.log(%22Deezer.Kids listening on port 
 8000
-/
 %22);%0A

Update server.js