tessellate-server
Web service runtime for tessellate services.
TessellateServer
import { TessellateServer } from 'tessellate-server'
constructor(options: Options = {})
name: string
Optional application name (see koa.app.name)
use(middleware: Middleware, defer: boolean = false): TessellateServer
Add koa Middleware that runs before any routes are handled. If defer
is set to true
, the middleware will run after all routes. Also see koa.app.use.
start(port: number | string, metricsPort?: number | string): Promise
Start the koa application server and prometheus metrics server on the specified ports. The default value for metricsPort
is port + 1
.
TessellateServer.router
koa-rx-router instance. Use it to add routes.
stop(): Promise
Stop all koa servers.
nconf
Wrapper around nconf with default values and convenience methods.
set(key: string, value: any)
- see nconfget(key: string)
- see nconfgetObject(key: string): Object
- seeget
getString(key: string): string
- seeget
argv(args: Object)
- see nconfdefaults(defaults: Object)
- see nconf
Problem
A throwable Error class modeled after Zalando Problem.
Example
Run npm start
or check out the code below:
const server = server serverrouter serverrouter serverstart3001