-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
32 lines (23 loc) · 844 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
/*
______ __ __ __ ______ __ __ __ ______
/\ __ \ /\ \/\ \ /\ \ /\ ___\ /\ \/ / /\ \ /\ ___\
\ \ \/\_\ \ \ \_\ \ \ \ \ \ \ \____ \ \ _"-. \ \ \ \ \ __\
\ \___\_\ \ \_____\ \ \_\ \ \_____\ \ \_\ \_\ \ \_\ \ \_____\
\/___/_/ \/_____/ \/_/ \/_____/ \/_/\/_/ \/_/ \/_____/
*/
//https://expressjs.com/en/starter/installing.html
// requires
const path = require('path');
// npm install express --save
const express = require('express');
const app = express();
// html server
app.use(express.static(path.join(__dirname, 'public')));
var port = 9876;
// on get request
app.get('/', (req, res) => {
res.sendFile(`${__dirname}/public/index.html`);
});
// start the web server
app.listen(port);
console.log('Server started! At http://localhost:' + port);