hubl/server.js
2018-11-14 16:33:03 +01:00

27 lines
612 B
JavaScript

const port = 9000;
const browserSyncPort = 3000;
const distPath = 'www';
// express server
const { join } = require('path');
const express = require('express');
const app = express();
app
.use(express.static(distPath))
// .use('/src', express.static(join(__dirname, 'src')))
.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,
port: browserSyncPort
// tunnel: true,
});