forked from busbud/coding-challenge-backend-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
30 lines (22 loc) · 803 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
29
30
const port = process.env.PORT || 2345;
const express = require('express');
const app = express();
const Suggestions = require ('./src/suggestions');
app.get('/suggestions', Suggestions.getSuggestions);
var server = app.listen(port, () => {
console.log('Server running at http://127.0.0.1:%d/suggestions', port);
});
module.exports = server;
// var http = require('http');
// var port = process.env.PORT || 2345;
// module.exports = http.createServer(function (req, res) {
// res.writeHead(404, {'Content-Type': 'text/plain'});
// if (req.url.indexOf('/suggestions') === 0) {
// res.end(JSON.stringify({
// suggestions: []
// }));
// } else {
// res.end();
// }
// }).listen(port, '127.0.0.1');
// console.log('Server running at http://127.0.0.1:%d/suggestions', port);