Component-based routing on top of Express
import*asexpressfrom"express"import{withRouterFactory,Router,Get,HandleFn,TryJson,Component,Handler,GetTryJson}from"express-component";classMyComponentimplementsComponent{nice: HandleFn=(req,res)=>({nice: "nice"})handleCatch=(err: any)=>{console.error(err)}getChildContext(){return"The context!"}render(){returnnewRouter({path: "/api",children: [newGetTryJson({path: "/nice",child: this.nice,onCatch: this.handleCatch})]})}}constapp=express()withRouterFactory(express.Router)(newMyComponent(),app)app.listen(9090)