-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
init.js
30 lines (22 loc) · 943 Bytes
/
init.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 express = require("express");
const path = require("path");
const config = require("./server/config");
const apiRoutes = require("./server/routes/api");
const middlewares = require("./server/middlewares");
const viewRoutes = require("./server/routes/views");
const app = express();
app.set("view engine", "ejs");
// Serve vue.js, page.js & axios to the browser
app.use(express.static(path.join(__dirname, "node_modules/axios/dist/")));
app.use(express.static(path.join(__dirname, "node_modules/vue/dist/")));
// Serve frontend assets & images to the browser
app.use(express.static(path.join(__dirname, "assets")));
app.use(express.static(path.join(__dirname, "assets/icons")));
app.use(middlewares);
app.use("/api", apiRoutes);
app.use("/", viewRoutes);
// Start the server
app.listen(config.PORT, null, function () {
console.log("Node version", process.version);
console.log("Webtag server running on port", config.PORT);
});