-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
27 lines (22 loc) · 720 Bytes
/
app.js
File metadata and controls
27 lines (22 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var http = require('http');
var express = require('express');
var ig = require('instagram-node').instagram();
var app = express();
app.set('view engine', 'jade');
app.use(express.static('public'));
ig.use({
client_id: 'CLIENT_ID',
client_secret: 'CLIENT_ID_SECRET'
});
app.get('/', function(req, res){
res.render('index', { title: 'Instagram', data: null});
});
app.get('/:tag', function(req, res){
var tag = req.params.tag;
ig.tag_media_recent(tag, function(err, medias, pagination, remaining, limit) {
res.render('index', { title: 'Instagram', data: medias});
});
});
var listener = app.listen(8888, function(){
console.log('Listening on port ' + listener.address().port);
});