-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathcli.site.js
More file actions
20 lines (17 loc) · 738 Bytes
/
cli.site.js
File metadata and controls
20 lines (17 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const chalk = require('chalk');
const path = require('path');
const express = require('express');
const app = express();
module.exports = (currentConfiguration, program) => {
if (!currentConfiguration.DIST_FOLDER) return console.log(chalk.red('No destination folder configured'));
const port = program.port || currentConfiguration.WEB_PORT;
app.get('/*', express.static(path.join(currentConfiguration.DIST_FOLDER)));
return new Promise((resolve, reject) => {
app.listen(port, () => {
console.log('serving your docsify site');
console.log(
`go to ${chalk.green('http://localhost:' + (program.port || currentConfiguration.WEB_PORT))}`
);
});
});
};