2.0.9 • Published 2 years ago

servino v2.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

⚡️ Servino

Servino is zero-configuration http server with hot reload.

Install

$ npm i -g servino
# or
$ npm i servino --save-dev

CLI

# Getting start
sv -r src -p 3000

# long command
sv --port 8125 --delay 500 --inject --wdir tests,public --ignore node_modules,.git

# short
sv -p 8125 -d 500 -w tests,public -i node_modules,.git -s tests/cert.pem,tests/key.pem

API

const Servino = require('Servino')

const servino = Servino(options?: object) : void

servino.start() // start server
servino.stop() // stop server

Available Options

options/CommandExampleDescription
--config or -cnullspecify where config json file is located (directory)
--host or -H'127.0.0.1'Set the server address
--port or -p8125Set the server port.
--root or -r'public'Set root directory that\'s being served. Default: current working directory
--ignore or -inode_modules,.gitwhich\'s files or folders should be ignored (Watch ignore)
--wdir or -wtests,publicPaths to watch for changes. Default: watch everything under root directory
--delay or -d200Realod time between changes (ms).
--inject or -ItrueInject Css and Javascript files without refresh the browser
--open or -otrueOpen url on the browser
--verbose or -VtrueShow logs
--ssl or -stests/cert.pem,tests/key.pemssl certifications

Config file: servino.json

/*
  command: sv -c tests
  A config file can take any of the command line arguments as JSON key values, for example:
*/
{
  "host": "0.0.0.0",
  "port": 8125,
  "root": ".",
  "wdir": [
    "app",
    "src"
  ],
  "delay": 100,
  "ignore":[
    "node_modules",
    "dist",
    ".git"
  ],
  "inject": true,
  "open": true,
  "verbose": true,
  "ssl": [
    "tests/cert.pem",
    "tests/key.pem"
  ]
}

TLS/SSL

First, you need to make sure that openssl is installed correctly, and you have key.pem and cert.pem files. You can generate them using this command:

openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem

Then you need to run the server with -s for your certificate files.

# Note: order important
servino -s tests/cert.pem,tests/key.pem

Notes

  • All pull requests are welcome, feel free.

Author

License

MIT

2.0.9

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.4

3 years ago

0.0.1

3 years ago