基于express/typescript的一款node.js框架
通过Npm 方式安装kvl
$ npm install kvl@latest -g
创建服务
import kvl from 'kvl';
import { Main ,Router, config } from 'kvl';
@Router({})
class HelloWord{
private msg: string = 'Hello, world'
@config({ url: '/hello', name: 'hello', type: 'get' })
private hello(req: kvl.Request, res: kvl.Response): void {
res.end(`<h1>${this.msg}</h1>`)
}
}
Main({
port: 8080,
router: [ HelloWord ],
}).then(({app,httpServer}) => {
})