-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (23 loc) · 796 Bytes
/
Copy pathindex.js
File metadata and controls
26 lines (23 loc) · 796 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
////////////////////////////////////////
// Packages
////////////////////////////////////////
const express = require('express')
const app = express()
const serv = require('http').Server(app)
const PORT = process.env.PORT || 3001
////////////////////////////////////////
// Server setup
////////////////////////////////////////
// the __dirname is the current directory from where the script is running
app.use(express.static(__dirname + '/public'))
// listen for requests
serv.listen(PORT, () => {
console.log(`Server listening for connections on port ${PORT}`)
})
///////////////////////////////////////
// Server started
///////////////////////////////////////
console.log(
`Web server has started!`,
`Link to app: http://localhost:${PORT}/index.html`
)