-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
31 lines (25 loc) · 871 Bytes
/
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
var express = require('express');
var business = require('./business');
var app = express();
app.use(express.bodyParser());
app.use(express.static(__dirname + '/views'));
app.get('/hello', function (req, res) {
res.send({message: 'Hello World'});
});
app.get('/allAvailableChannels', function (req, res) {
business.getAllAvailableChannels(function (code, channels) {
res.send(code, channels);
});
});
app.post('/user/:userID/order', function (req, res) {
business.manageOrder(req.params.userID, req.body, function (code, returnObject) {
res.send(code, returnObject);
});
});
app.post('/sendOffer', function (req, res) {
business.sendOffer(req.body, function (code, returnObject) {
res.send(code, returnObject);
});
});
app.listen(3000);
console.log("Server up and listening on port 3000");