-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
33 lines (28 loc) · 751 Bytes
/
Copy pathserver.js
File metadata and controls
33 lines (28 loc) · 751 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
27
28
29
30
31
32
33
import 'babel-polyfill'
import Express from 'express'
let app = Express()
const PORT = 3000
app.use(Express.static('public'))
app.get('*', handleRender)
function handleRender(req, res) {
res.status(200).send(renderFullPage())
}
function renderFullPage() {
return `
<!DOCTYPE html>
<html>
<head>
<title>Straustrup Library</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<script src="/bundle.js"></script>
</body>
</html>
`
}
app.listen(PORT, function() {
console.log('http://localhost:', PORT)
})