-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
31 lines (24 loc) · 901 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
const path = require("path");
const postRouter = require("./src/routing/posts");
const fileRouter = require("./src/routing/files");
const checktagsRouter = require("./src/routing/checktags");
const autocompleteRouter = require("./src/routing/autocomplete");
const port = 6969;
const express = require("express");
const cors = require("cors");
const app = express();
app.use(cors());
app.use("/posts", postRouter);
app.use("/files", fileRouter);
app.use("/checktags", checktagsRouter);
app.use("/autocomplete", autocompleteRouter);
app.use("/static", express.static(path.join(__dirname, "public")));
app.get("/", function (req, res) {
res.sendFile(path.join(__dirname, "/src/pages/index.html"));
});
app.get("/p", function (req, res) {
res.sendFile(path.join(__dirname, "/src/pages/viewer.html"));
});
app.listen(port, function () {
console.log("App listening on port " + port + ".");
});