modofunjs / modofun Goto Github PK
View Code? Open in Web Editor NEWA fast function router for serverless Node.js applications
Home Page: https://modofun.js.org
License: MIT License
A fast function router for serverless Node.js applications
Home Page: https://modofun.js.org
License: MIT License
My routes currently look something like this:
{
'abcLogin': handleAbcLogin,
'abcLogout': handleAbcVerify,
'abcDoAction': handleAbcDoAction,
'xyzLogin': handleXyzLogin,
'xyzLogout': handleXyzVerify,
'xyzDoAction': handleXyzDoAction
}
but I'd like the paths to look like this:
{
'abc/Login': handleAbcLogin,
'abc/Logout': handleAbcVerify,
'abc/DoAction': handleAbcDoAction,
'xyz/Login': handleXyzLogin,
'xyz/Logout': handleXyzVerify,
'xyz/DoAction': handleXyzDoAction
}
Adding a slash into the path doesn't appear to work. I also considered trying to created multiple modofun routers so I could have a master router with just routes for abc
and xyz
and then have 'sub' routers for each of the three routes within abc and xyz. However, afaics that's not going to work because modofun expects the incoming thing to look like a request from AWS etc.
Is there any other way of achieving this?
(this is a really useful library btw, I've used it in loads of serverless projects over the years, thank you!)
Will it be possible to provide typescript type definitions for modofun? I'm using the lib with google cloud functions project written in typescript.
Thank for the great work,
Hello Team,
https://github.com/modofunjs/modofun/blob/master/examples/todo-aws-lambda/index.js
Can I have more than one module
const myModule = require('./myModule');
and export them together to be registered in the serverless framework.
for e.g
const myModule = require('./myModule');
const yourModule = require('./yourModule');
exports.handler = modofun(myModule, yourModule, [ morgan('tiny') ])
If such feature is not available now, is this requirement can be considered for future enhancement.
Thanks and Regards,
Raj
cafeServer.get('/:shopId/coupons/offers', ...)
I'm migrating a express based server to modofun, but couldn't find a way to define custom paths or path-params like this. I understand that modofun is designed with simplicity in mind, but for the router to be useful, it needs to support url paths, otherwise the utility of this library will be limited to extremely simply use-cases.
Thanks,
Is there a way, in Function mode, to return a 302 redirect type response? Or would I need to move to Request/Response mode for that? Thanks, cool library.
I'd like to pass a request to a function with definitely 1 and possibly 2 arguments. I tried making the second argument optional by assigning it a default argument but now I'm seeing an error stating that only one parameter is required and I passed two.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.