-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
26 lines (21 loc) · 728 Bytes
/
server.js
File metadata and controls
26 lines (21 loc) · 728 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
25
26
import express from "express";
import http from "http";
import path from "path";
import initAPI from "./api/index.js";
import updater from "./lib/server/updater.js";
const PORT = process.env.PORT || 1930;
const app = express();
const server = http.createServer(app);
const dirname = process.cwd();
const publicPath = path.join(dirname, "public");
console.log(`Serving files from ${publicPath}`);
app.use("/lib/client", express.static(path.join(dirname, "lib", "client")));
app.use(express.static(publicPath));
updater(server, publicPath);
const main = async () => {
await initAPI(app);
server.listen(PORT, () => {
console.log(`Server started. Now open http://localhost:${PORT}/ in your browser.`);
});
};
main();