hubl/server.js

27 lines
612 B
JavaScript
Raw Normal View History

2018-09-28 19:20:15 +00:00
const port = 9000;
2018-11-14 15:33:03 +00:00
const browserSyncPort = 3000;
2018-09-28 19:20:15 +00:00
const distPath = 'www';
2018-11-14 15:33:03 +00:00
2018-09-28 19:20:15 +00:00
// 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);
2018-11-14 15:33:03 +00:00
2018-09-28 19:20:15 +00:00
// browser sync
const bs = require('browser-sync').create();
bs.init({
files: [distPath + '/**/*'],
proxy: `http://localhost:${port}`,
open: false,
notify: false,
2018-11-14 15:33:03 +00:00
port: browserSyncPort
// tunnel: true,
2018-09-28 19:20:15 +00:00
});