-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
39 lines (29 loc) · 1.08 KB
/
app.js
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
29
30
31
32
var express = require('express');
var routes = require('./service/routes')
var app = express();
app.set('views', __dirname + '\\views');
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'ejs');
app.use(express.static(__dirname + '/Assets'));
var bodyParser = require('body-parser');
app.use(bodyParser.json());
app.listen(4000);
console.log('runing @ 4000');
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
//#######################################################
// API ROUTING
//#######################################################
app.get('/search',routes.search);
app.get('/ProductDetail',routes.productDetails);
app.get('/navigation',routes.sitenavigation);
app.put('/login',routes.login);
app.get('/trolley',routes.getTrolley);
app.put('/miniTrolley',routes.updateMiniTrolley);
app.get('/categories',routes.getProductByCategory);
app.get('/', function (req, res) {
res.render('index.html');
});