Giter VIP home page Giter VIP logo

modofun's People

Contributors

fptavares avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

modofun's Issues

How to split routes into multiple paths and subpaths?

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!)

Typescript Type Definitions

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,

Support for more than one functionality

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

Support for path params

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,

302 redirect in Function mode

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.

Are optional route parameters possible?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.