Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Sevilleja committed Mar 3, 2015
1 parent d134b81 commit 4a6c63a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 47 deletions.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion app3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 8 additions & 15 deletions app3/server.js
Original file line number Diff line number Diff line change
@@ -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
// ==================================================
Expand All @@ -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'
});
Expand All @@ -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 });
});
Expand All @@ -40,5 +33,5 @@ app.get('/', function(req, res) {

// START THE SERVER
// ==================================================
app.listen(port);
console.log('App started! Look at http://localhost:' + port);
app.listen(8080);
console.log('App started! Look at http://localhost:8080');
62 changes: 31 additions & 31 deletions app3/views/pages/index.ejs
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<% include ../partials/head %>
<% include ../partials/head %>
</head>
<body class="container">

<header>
<div class="jumbotron text-center">
This is a demo for a <a href="https://scotch.io">Scotch.io</a> tutorial.
</div>
<% include ../partials/header %>
</header>
<header>
<div class="jumbotron text-center">
This is a demo for a <a href="https://scotch.io">Scotch.io</a> tutorial.
</div>
<% include ../partials/header %>
</header>

<main>
<div class="row">
<% grams.forEach(function(gram) { %>
<div class="instagram-pic col-sm-3">
<main>
<div class="row">
<% grams.forEach(function(gram) { %>
<div class="instagram-pic col-sm-3">
<a href="<%= gram.link %>" target="_blank">
<img src="<%= gram.images.standard_resolution.url %>" class="img-responsive">
</a>
<a href="<%= gram.link %>" target="_blank">
<img src="<%= gram.images.standard_resolution.url %>" class="img-responsive">
</a>
<div class="instagram-bar">
<div class="likes">
<span class="glyphicon glyphicon-heart"></span> <%= gram.likes.count %>
</div>
<div class="comments">
<span class="glyphicon glyphicon-comment"></span> <%= gram.comments.count %>
</div>
</div>
<div class="instagram-bar">
<div class="likes">
<span class="glyphicon glyphicon-heart"></span> <%= gram.likes.count %>
</div>
</div>
<% }); %>
</div>
</main>
<div class="comments">
<span class="glyphicon glyphicon-comment"></span> <%= gram.comments.count %>
</div>
</div>
<footer>
<% include ../partials/footer %>
</footer>

</div>
<% }); %>
</div>
</main>

<footer>
<% include ../partials/footer %>
</footer>

</body>
</html>

0 comments on commit 4a6c63a

Please sign in to comment.