// based on the minimal demo from https://www.npmjs.com/package/serve import handler from 'serve-handler'; import http from 'http'; import 'dotenv/config'; import { ENV } from './lib/env.js'; import { BasePaths } from './lib/render/base-paths.js'; const isDebugEnabled = ENV.getBoolean('VS_DEBUG'); const directory = BasePaths.targetRoot(); const options = { public: directory, directoryListing: isDebugEnabled, }; const server = http.createServer((req, res) => { return handler(req, res, options); }); server.listen(3000, () => { console.log('Running on port 3000'); if(isDebugEnabled) { console.log(options); } });