forked from logorn/NodeJS-REST-API-SQLite
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
24 lines (19 loc) · 619 Bytes
/
index.js
File metadata and controls
24 lines (19 loc) · 619 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* Load modules */
const express = require("express");
const app = express();
const bodyParser = require("body-parser");
/* Database configuration */
const database = require('./app/config/dbconfig');
/* Init database */
database.init();
/* Init server listening */
const port = process.argv[2] || 3000;
app.listen(port, function () {
console.log("Server listening on port : " + port);
});
/* Express configuration */
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
/* Router configuration */
const REST_API_ROOT = '/api';
app.use(REST_API_ROOT, require('./app/routes/router'));