@zerva/http
TypeScript icon, indicating that this package has built-in type declarations

0.64.0 • Public • Published

🌱 Zerva useHttp

Express web server.

Emits httpInit before the server starts. Use this to set up custom routes. The custom helpers get, post and addStatic help to make this a concise operation. You also have access to http and app to get the full power of Express and attach e.g. WebSocket servers. See zerva-websocket for demos.

httpRunning is emitted after the web server is listening.

On httpStop you can do some optional cleanup for your web server.

Minimal Example

Will serve on http://localhost:8080:

import { serve } from '@zerva/core'
import { useHttp } from '@zerva/http'

useHttp()
serve()

Config

interface Config {
  host?: string
  port?: number // default: 8080
  sslCrt?: string
  sslKey?: string
}

Readme

Keywords

Package Sidebar

Install

npm i @zerva/http

Weekly Downloads

34

Version

0.64.0

License

MIT

Unpacked Size

156 kB

Total Files

9

Last publish

Collaborators

  • zerva