@roshangara/mini-webservice
v1.1.3
Published
Develop and ExpressJS webserver using TypeScript
Downloads
4
Readme
ExpressTypeScript
Develop an ExpressJS webserver using TypeScript
create Controller ExampleController.ts
import { Request, Response } from 'express';
import { Controller, Get } from '@overnightjs/core';
@Controller('api')
export default class ExampleController {
@Get(':msg')
private getMessage(req: Request, res: Response) {
res.status(200).json({
message: req.params.msg,
});
}
}
create Controller ExampleController.ts
import ClusterServer from '@roshangara/mini-webservice/src/ClusterServer'
import ExampleController from './controllers/ExampleController';
let app = new ClusterServer([ExampleController]);
app.start();