hubl/server.js

25 lines
608 B
JavaScript
Raw Normal View History

2018-09-28 19:20:15 +00:00
const port = 9000;
2018-10-31 09:38:41 +00:00
const browsersyncPort = 3000;
2018-09-28 19:20:15 +00:00
const distPath = 'www';
// express server
const { join } = require('path');
const express = require('express');
const app = express();
app
.use(express.static(distPath))
2018-10-05 09:37:48 +00:00
// .use('/src', express.static(join(__dirname, 'src')))
2018-09-28 19:20:15 +00:00
.get(/^[^.]*$/, (req, rep) =>
rep.sendFile(join(__dirname, distPath, '/index.html')),
)
.listen(port);
// browser sync
const bs = require('browser-sync').create();
bs.init({
files: [distPath + '/**/*'],
proxy: `http://localhost:${port}`,
open: false,
notify: false,
2018-10-31 09:38:41 +00:00
port: browsersyncPort,
tunnel: true,
2018-09-28 19:20:15 +00:00
});