2017-05-24 20:07:43 +02:00
|
|
|
// load dependencies
|
|
|
|
var express = require('express');
|
|
|
|
var bodyParser = require('body-parser');
|
|
|
|
var path = require('path');
|
|
|
|
// set port
|
2017-05-24 23:22:56 +02:00
|
|
|
var PORT = 3000;
|
2017-05-24 20:07:43 +02:00
|
|
|
// initialize express
|
|
|
|
var app = express();
|
|
|
|
// make express look in the public directory for assets (css/js/img)
|
|
|
|
app.use(express.static(__dirname + '/public'));
|
|
|
|
// configure epress
|
|
|
|
app.use(bodyParser.json()); // for parsing application/json
|
|
|
|
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
|
|
|
|
// require in routes
|
|
|
|
require("./routes/api-routes.js")(app);
|
|
|
|
require("./routes/html-routes.js")(app);
|
|
|
|
// start server
|
|
|
|
app.listen(PORT, function() {
|
|
|
|
console.log("Listening on PORT " + PORT);
|
|
|
|
});
|