-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
21 lines (18 loc) · 853 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//
// This is where the app starts, and sets things up
// We require the packages we need, body parser and express, and then set up body parser to accept
// JSON and URL encoded values. We then include the `routes.js` file, in which we define the API
// end-points we're going to be using, and we pass it the `app` variable. Lastly, we specify the
// port to listen to for requests. In this case, port 3000.
//
var express = require("express");
var bodyParser = require("body-parser");
var app = express();
// http://expressjs.com/en/starter/static-files.html
app.use(express.static('public'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
var routes = require("./routes.js")(app);
var server = app.listen(process.env.PORT || 3000, function () {
console.log("Listening on port %s", server.address().port);
});