@tim-code/server

0.9.0 • Public • Published

server

A wrapper around Express

npm install @tim-code/server

CLI

The CLI of server is a wrapper around Nodemon

Options

const args = commandLineArgs([
  { name: "headers", alias: "h", type: JSON.parse },
  { name: "port", alias: "p", type: Number },
  { name: "forbid", type: String },
  { name: "log", type: Boolean },
  { name: "frontend", type: resolve },
  { name: "routes", type: resolve, defaultOption: true },
  { name: "postSize", type: String },
  { name: "host", type: String },
  { name: "expressRoute", type: Boolean },
  { name: "spa", type: String },
])

Typical Usage

server --log --routes backend --watch package-lock.json

Note that --routes folder is automatically watched if specified.

If no --port is specified, then Node will randomly assign one. If --log is specified, a message including the port will be printed to the console in addition to the normal output logged.

By default, folders starting with _ cannot be routed to due to the default value of --forbid.

Serve Folder

server --frontend dist --port 4000

Environment Variables

server does not make use of environment variables directly but code executed via the routes folder can make use of them.

Readme

Keywords

none

Package Sidebar

Install

npm i @tim-code/server

Weekly Downloads

2

Version

0.9.0

License

MIT

Unpacked Size

9.13 kB

Total Files

9

Last publish

Collaborators

  • timspro