theodore
http framework
Last updated 5 years ago by mk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install theodore 
SYNC missed versions from official npm registry.

theodore

super fast http framework

API Stability Build Status Standard - JavaScript Style Guide Standard Version

Install

npm i theodore

Use

const Theodore = require('theodore')
const app = new Theodore()

app.get('/', (req, res, params) => res.send('hello world', 200))
app.get('/status', (req, res, params) => res.send('OK', 200))
app.get('/cats', (req, res, params) => res.json(['theodore', 'sally', 'glory'], 200))

app.listen()

How?

theodore uses turbo-http under the hood and adds a router and similar API to other http frameworks. It also adds some convenience methods that allow you to send JSON responses by using the fast-safe-stringify package. When parsing JSON data it is using fast-json-parse.

API

app = new Theodore()

Create a new server.

app.{get,post,put,delete}(route, handler(req, res, params))

Create a route that matches the method and route.

req.body

If the request has a body it will be parsed based on content type and placed in req.body.

res.json(json, statusCode)

Will set the content type and stringify the JSON for you.

res.send(data, statusCode)

Send a response down the line.

Current Tags

  • 1.5.2                                ...           latest (5 years ago)

12 Versions

  • 1.5.2                                ...           5 years ago
  • 1.5.1                                ...           6 years ago
  • 1.5.0                                ...           6 years ago
  • 1.4.0                                ...           6 years ago
  • 1.3.0                                ...           6 years ago
  • 1.2.1                                ...           7 years ago
  • 1.2.0                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.5                                ...           7 years ago
  • 1.0.4                                ...           7 years ago
  • 1.0.3                                ...           7 years ago
  • 1.0.2                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (6)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |