0.6.0 • Published 4 years ago

herver v0.6.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

herver

Introduction

herver is a modern server lib which aims at being versatile but lightweight.

Features

  • :bulb: Promise-based APIs
  • :package: Built-in router support
  • :rocket: High extensibility
  • :wrench: Useful utilities
  • :books: TypeScript support

Links

Example

// import APIs
const { App, Router, createStaticHandler } = require('herver');

// create an app and a router
const app = new App(),
    router = new Router();

// handle POST requests to `/echo` (e.g.: `POST /echo?msg=test`)
router.post('/echo', async (context, next) => {
    // end the response with the query parameter `msg`
    context.endWithContent('' + context.queries.get('msg'));
});

// serve all GET requests with corresponding static files in the public folder
router.get(/^\//, createStaticHandler('/path/to/public'));

// apply the router to the app and starts the app at port 8080
app.use(router.handler)
    .listen(8080);
0.6.0

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.3.1

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago