diff --git a/app3/.gitignore b/.gitignore similarity index 100% rename from app3/.gitignore rename to .gitignore diff --git a/app3/README.md b/README.md similarity index 100% rename from app3/README.md rename to README.md diff --git a/app3/package.json b/app3/package.json index 21b054e..d8638f8 100644 --- a/app3/package.json +++ b/app3/package.json @@ -18,7 +18,6 @@ }, "homepage": "https://github.com/scotch-io/node-booklet-code", "dependencies": { - "body-parser": "^1.12.0", "ejs": "^2.3.1", "express": "^4.12.1", "instagram-node": "^0.5.6" diff --git a/app3/server.js b/app3/server.js index 6337e2f..6055ca1 100644 --- a/app3/server.js +++ b/app3/server.js @@ -1,10 +1,8 @@ // GRAB THE PACKAGES/VARIABLES WE NEED // ================================================== -var express = require('express'), - app = express(), - bodyParser = require('body-parser'), - instagram = require('instagram-node').instagram(), - port = process.env.PORT || 8080; +var express = require('express'); +var app = express(); +var ig = require('instagram-node').instagram(); // CONFIGURE THE APP // ================================================== @@ -14,13 +12,8 @@ app.use(express.static(__dirname + '/public')); // set the view engine to ejs app.set('view engine', 'ejs'); -// configure body-parser which lets us grab POST data -// parse application/x-www-form-urlencoded and application/json -app.use(bodyParser.urlencoded({ extended: false })); -app.use(bodyParser.json()); - -// configure instagram app with client-id -instagram.use({ +// configure instagram app with client_id +ig.use({ client_id: 'e0e51c60672c4f09abe28c46c71a3a7a', client_secret: 'db11c575a8ae4f1aa90a03ba1d1345d8' }); @@ -31,7 +24,7 @@ instagram.use({ app.get('/', function(req, res) { // use the instagram package to get popular media - instagram.media_popular(function(err, medias, remaining, limit) { + ig.media_popular(function(err, medias, remaining, limit) { // render the home page and pass in the popular images res.render('pages/index', { grams: medias }); }); @@ -40,5 +33,5 @@ app.get('/', function(req, res) { // START THE SERVER // ================================================== -app.listen(port); -console.log('App started! Look at http://localhost:' + port); \ No newline at end of file +app.listen(8080); +console.log('App started! Look at http://localhost:8080'); \ No newline at end of file diff --git a/app3/views/pages/index.ejs b/app3/views/pages/index.ejs index 347fa1f..3ee7933 100644 --- a/app3/views/pages/index.ejs +++ b/app3/views/pages/index.ejs @@ -1,44 +1,44 @@
- <% include ../partials/head %> + <% include ../partials/head %> -