forked from kapilsaini/node_app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
28 lines (26 loc) · 874 Bytes
/
Copy pathapp.js
File metadata and controls
28 lines (26 loc) · 874 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
28
var express = require('express')
var app = express()
var request = require('request')
app.get('/', function (req, res) {
res.render('demo.jade');
})
app.get('/products/', function (req, res) {
res.render('products.jade', { currentURL:'products'});
})
app.get('/inventory', function (req, res) {
res.render('inventory.jade', { currentURL:'inventory' });
})
app.get('/feedback', function (req, res) {
request('http://127.0.0.1:9010/feedbacks', function (error, response, body) {
console.log("error->"+ error)
console.log("response->"+response)
console.log("body->"+JSON.parse(body))
if (!error && response.statusCode == 200) {
var info = JSON.parse(body)
res.render('feedback.jade', {currentURL:'feedback', data: info});
}
})
})
app.listen(3001, function () {
console.log('app listening on port 3001!')
})