@aminnairi/serve
v0.3.4
Published
Command-line interface for serving files.
Downloads
20
Readme
@aminnairi/serve
Command-line interface for serving files.
$ npx @aminnairi/serve --folder client
Serving files from the client folder at http://127.0.0.1:8000. Hit CTRL+C at any time to stop.
Requirements
Usage
NPX
$ npx @aminnairi/serve --help
NPM
$ npm install @aminnairi/serve
$ node ./node_modules/.bin/serve --help
Global
$ sudo npm install --global @aminnairi/serve
$ serve --help
Docker
$ docker run --interactive --tty --user node --workdir /home/node --volume "$PWD":/home/node --publish 8000:8000 node npx @aminnairi/serve --host 0.0.0.0 --port 8000
Docker Compose
$ touch docker-compose.yaml
version: "3"
services:
server:
image: node
user: node
working_dir: /home/node
command: npx @aminnairi/serve --host 0.0.0.0 --port 8000
ports:
- 8000:8000
volumes:
- .:/home/node
$ docker-compose up server
Examples
Folder
The folder from where to serve the static folder (default to the current folder).
$ serve --folder public
Host
The host from which to listen (default to 127.0.0.1).
$ serve --host 0.0.0.0
Port
The port from which to listen (default to 8000). Fail if not an integer.
$ serve --port 5000
Single-page application
Whether to route all request to the current folder's index.html file (default to false).
$ serve --spa
Base
Set a base prefix url (default to empty) useful for GitHub Pages for instance.
$ serve --base aminnairi
Verbose
Display error message on the console instead of hidding them.
$ serve --verbose
Help
Display the help in the console.
$ serve --help