Skip to content

serviejs/servie-send

Repository files navigation

Servie Send

NPM version NPM downloads Build status Test coverage

Create a HTTP response to send using Servie - a thin layer for creating a Response object with cache headers.

Installation

npm install servie-send --save

Usage

import { sendText, sendHtml, sendJson, sendStream, sendEmpty } from 'servie-send'

function handle (req) {
  return sendText(req, 'hello world!')
  return sendHtml(req, '<!doctype html>')
  return sendJson(req, { json: true })
  return sendStream(req, fs.createReadStream('example.txt'))
  return sendEmpty(req) // Nothing in response.
}

TypeScript

This project is written using TypeScript and publishes the definitions directly to NPM.

License

Apache 2.0

About

Generate a HTTP response with client-side cache support

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published