replace unmaintained static-server with serve

This commit is contained in:
Martin Raifer
2025-02-25 14:07:16 +01:00
parent ee3bcb5102
commit 024c3f2dc4
3 changed files with 87 additions and 155 deletions

View File

@@ -1,7 +1,7 @@
/* eslint-disable no-console */
const http = require('http');
const chalk = require('chalk');
const gaze = require('gaze');
const StaticServer = require('static-server');
const serve = require('serve-handler');
const buildCSS = require('./build_css.js');
@@ -10,7 +10,13 @@ gaze(['css/**/*.css'], (err, watcher) => {
watcher.on('all', () => buildCSS());
});
const server = new StaticServer({ rootPath: process.cwd(), port: 8080, followSymlink: true });
server.start(() => {
const server = http.createServer((request, response) => {
return serve(request, response, {
symlinks: true
});
});
server.listen(8080, () => {
/* eslint-disable no-console */
console.log(chalk.yellow(`Listening on ${server.port}`));
});