-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
32 lines (20 loc) · 838 Bytes
/
server.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 bodyParser = require("body-parser");
var path = require("path");
var app = express();
var PORT = process.env.PORT || 8080;
app.use(express.static(path.join(__dirname, 'public')));
// application/x-www-form-urlencoded parser
app.use(bodyParser.urlencoded({ extended: true }));
// parse various different custom JSON types as JSON
app.use(bodyParser.json({ type: "application/**json"}))
// parse custom things into a Buffer
app.use(bodyParser.raw({ type: "application/vnd.custom_type" }))
// parse HTML body into a string
app.use(bodyParser.text({ type: "text/html" }))
require("./app/routing/html-routes.js")(app);
require("./app/routing/api-routes.js")(app);
require("./app/routing/html-routes.js")(app);
app.listen(PORT, function() {
console.log("App listening on PORT: " + PORT);
});