Skip to content

Repository files navigation

OreDoc: @oresoftware/doc & oredoc

To use OreDoc, you would write code resembling:

import*asexpressfrom'express';import{RequestHandler}from'express';import{DocGen,Entity,Route,RouteBase,RouteMulti}from'../dist/main';constrouter=express.Router();constdoc=newDocGen();exportconstregister=(v: any)=>{constentity=doc.createAndAddEntity('foo');router.get('/',makeGetFoo(v,entity));router.put('/',makePutFoo(v,entity));};constmakeGetFoo=(v: any,e: Entity): RequestHandler=>{constr=newRouteMulti({headers: {},body: {}},{body: {success: {foo: 'yes'}}});//typeSuccessResponse=typeofr.res.body.success;e.addRoute({path: '',example: r});return(req,res,next)=>{constheaders=req.headers.foo;res.json(<SuccessResponse>{foo: ''});};};constmakePutFoo=(v: any,e: Entity): RequestHandler=>{interfaceResponse{}return(req,res,next)=>{res.json(<Response>{success: 'f'});};};

Releases

Packages

Contributors

Languages