You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm interested in using feTS with AWS Lambda, but would like to optimise memory usage and cold-start times.
One way I've done this with other frameworks like Hono is to split handlers in to JS modules, and lazy import so that only the requested route handler needs to be loaded in to memory.
Something like this:
constroutes={"/foo": (awaitimport('./routes/foo.ts')).router,"/bar": (awaitimport('./routes/bar.ts')).router,}asconst;exportconsthandler=async(event)=>{constpath=event.rawPathaskeyoftypeofroutes;// invoke the appropriate feTS routerroutes[path].fetch(path)}
Wondered if anyone has done this and has a TypeScript example?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm interested in using feTS with AWS Lambda, but would like to optimise memory usage and cold-start times.
One way I've done this with other frameworks like Hono is to split handlers in to JS modules, and lazy import so that only the requested route handler needs to be loaded in to memory.
Something like this:
Wondered if anyone has done this and has a TypeScript example?
Beta Was this translation helpful? Give feedback.
All reactions