chef-express

chef-js + express = static files server

Usage no npm install needed!

<script type="module">
  import chefExpress from 'https://cdn.skypack.dev/chef-express';
</script>

README

chef-express

npm package version tests status

static files server designed for node written in typescript, with tests

  • express for routing

Running

$ [PORT=4200] [yarn|npx] chef-express folder [--debug] [--ssl] [--key example.key] [--cert example.crt]
const startServer = require("chef-express");

startServer({
  // this enables http/ws logs
  debug: process.argv.includes("--debug"),
  // port on which the server listens
  port: Number(process.env.PORT || 4200),
  // folder to static serve files
  folder: process.argv[2],
  // ssl = undefined | { key, cert }
  ssl: process.argv.includes("--ssl") ? ssl : undefined,
}).then((server: Express.Application) => {
  // server router api is get, post, any
  server.any("/*", (req: Express.Request, res: Express.Response) => {
    res.end("200 OK");
  });
});
  • PORT=4200 - choose server port
  • folder - folder you want to serve static files from
  • --debug - show logs
  • --ssl - start as https server, with self signed certificate
  • --key example.key - path to real certificate key, use with --ssl
  • --cert example.crt - path to real certificate, use with --ssl

Install

$ yarn add chef-express

License

MIT