-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
34 lines (26 loc) · 930 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
const path = require('path');
const express = require('express');
const server = express();
server.use(express.static(path.join(__dirname, 'public')));
server.get('*', async function (req, res) {
res.write(`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<title>Svelte app</title>
<link rel='icon' type='image/png' href='/favicon.png'>
<link rel='stylesheet' href='/global.css'>
<link rel='stylesheet' href='/build/bundle.css'>
<script>window.componentProps={ url: "${req.url}" }</script>
<script defer src='/build/bundle.js'></script>
</head>
<body>
</body>
</html>
`);
res.end();
});
const port = 3000;
server.listen(port, () => console.log(`Listening on port ${port}`));