forked from Automattic/mongoose
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatic.js
More file actions
33 lines (24 loc) · 715 Bytes
/
static.js
File metadata and controls
33 lines (24 loc) · 715 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
'use strict';
const express = require('express');
const app = express();
const website = require('./website');
const port = process.env.PORT
? parseInt(process.env.PORT, 10)
: 8089;
async function main() {
await Promise.all([
website.copyAllRequiredFiles(),
website.pugifyAllFiles()
]);
// start watching for file changes and re-compile them, so that they can be served directly
website.startWatch();
app.use('/', express.static(website.cwd));
app.listen(port, () => {
let urlPath = '/';
if (website.versionObj.versionedDeploy) {
urlPath = website.versionObj.versionedPath;
}
console.log(`now listening on http://127.0.0.1:${port}${urlPath}`);
});
}
main();