-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
40 lines (34 loc) · 961 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
32
33
34
35
36
37
38
39
40
/**
* @project GitLab - https://obrymec.github.io/gitlab_home_page_clone/
* @fileoverview Defines server configs with expressjs.
* @author Obrymec - [email protected]
* @supported DESKTOP, MOBILE
* @created 2021-09-21
* @updated 2023-06-09
* @file server.js
* @type {Server}
* @version 0.0.1
*/
// Node dependencies.
import {fileURLToPath} from "url";
import path from "path";
// Plugin dependencies.
import express from "express";
// Attributes.
const __filename = fileURLToPath (import.meta.url);
const __dirname = path.dirname (__filename);
const app = express ();
const port = 5000;
// Configurations.
app.use (express.static (__dirname));
// Root or unknown link.
app.get (
"/*", (_, res) => res.sendFile (`${__dirname}/index.html`)
);
// Starts the server.
app.listen (port, err => {
// Whether an error is thrown.
if (err) console.error ("Server Error: ", err);
// Otherwise.
else console.log ("Server started at port: ", port);
});