Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tessellate-server

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tessellate-server

Tessellate server runtime.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

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

import { nconf } from 'tessellate-server'

Wrapper around nconf with default values and convenience methods.

  • set(key: string, value: any) - see nconf
  • get(key: string) - see nconf
  • getObject(key: string): Object - see get
  • getString(key: string): string - see get
  • argv(args: Object) - see nconf
  • defaults(defaults: Object) - see nconf

Problem

import { Problem } from 'tessellate-server'

A throwable Error class modeled after Zalando Problem.

Example

Run npm start or check out the code below:

import { TessellateServer, Problem } from '../src'
import { Observable } from 'rxjs'

const server = new TessellateServer()

server.use((ctx, next) => {
  console.log('Hi, this is middleware.')
  return next()
})

server.router.get('/', o => o.mapTo('Hello!'))

server.router.get('/error', o => o.switchMapTo(Observable.throw(
  new Problem({
    title: 'Teapot',
    detail: 'I am a teapot.',
    status: 418
  }))
))

server.start(3001)

FAQs

Package last updated on 01 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc