@ttoss/http-server
v0.1.1
Published
HTTP Server for ttoss environment
Downloads
9
Readme
@ttoss/http-server
HTTP server for Node.js for ttoss ecosystem.
Installation
pnpm add @ttoss/http-server
Usage
import { App, Router, bodyParser, cors } from '@ttoss/http-server';
const app = new App();
app.use(cors());
app.use(bodyParser());
const route = new Router();
route.get('/health', (ctx) => {
ctx.body = 'OK';
});
app.use(route.routes());
app.use(router.allowedMethods());
app.listen(3000, () => {
console.log('Server is running on port 3000');
});
API
Some methods are re-exports from other libraries:
App
- Koa applicationRouter
- Koa routerbodyParser
- Koa body parsercors
- Koa CORS