hubl/server.js

23 lines
555 B
JavaScript
Raw Normal View History

2018-09-28 19:20:15 +00:00
const port = 9000;
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,
//tunnel: true,
});