Dee - Powered by express and openapi
Features
- Document driven development
- Use openapi to autobind router, auto parse and verify request.
- Easy to use 3-party service, could be bond through config
Get started
Install Dee web framework
npm i @sigodenjs/dee -S
Init Dee App
import * as Dee from "@sigodenjs/dee";
import * as path from "path";
import * as handlers from "./handlers";
import * as DeeIORedis from "@sigodenjs/dee-ioredis";
Dee({
config: {
ns: "proj",
name: "App"
},
openapize: {
api: path.resolve(__dirname, "./openapi.yaml"),
handlers
},
services: {
redis: {
initialize: DeeIORedis.init,
args: {
port: 6379
}
}
}
}).then(app => {
app.start();
});
Write route handlers
export function hello(req: Request, res: Response, next: NextFunction) {
const name = req.query.name;
req.srvs.redis;
res.json(name);
}
Licese
Copyright (c) 2018 sigoden
Licensed under the MIT license.