hubl/server.js

33 lines
727 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,
files: [
'www/styles/index.css',
'www/scripts/index.js',
'www/index.html',
'www/images/**',
'www/fonts/**'
]
});