Giter Club home page Giter Club logo

Comments (9)

vikaskandari avatar vikaskandari commented on May 25, 2024

can you explain a little bit more maybe put an example

from node-decorators.

serhiisol avatar serhiisol commented on May 25, 2024

Hi @markkelsall. At the moment simple functions are not supported. All the middlewares have to be classes. In order to use plain function you would need to wrap it. Is it inconvenient to use middleware as classes?

from node-decorators.

markkelsall avatar markkelsall commented on May 25, 2024

Hi @serhiisol ok got it.
Yes ideally it would be better to be able to use simple functions (async included) as middleware as well as classes.
I was under the impression that the code supported it and it was just the typings that I was getting wrong, based on this - https://github.com/serhiisol/node-decorators/blob/master/express/src/middleware.ts

from node-decorators.

serhiisol avatar serhiisol commented on May 25, 2024

I’m going to add support of the simple functions

from node-decorators.

markkelsall avatar markkelsall commented on May 25, 2024

That would be great, will make adoption for new devs a lot easier!
Do let me know when you have a change ready to look at

from node-decorators.

markkelsall avatar markkelsall commented on May 25, 2024

Hi, @serhiisol, is the only change for this issue/feature request the one commit then? I saw there are a few things going in as part of this linked PR and results in a new major version

from node-decorators.

serhiisol avatar serhiisol commented on May 25, 2024

Most of the changes are required and probably it might break something.That's why I called it major changes. For example, if you're returning something you would need to be able to setup status code. Then there were few bugs that I fixed. Technically I can only revert the update of express.

from node-decorators.

serhiisol avatar serhiisol commented on May 25, 2024

Ok, I’ll try to split the changes into a bunch of PRs

from node-decorators.

markkelsall avatar markkelsall commented on May 25, 2024

Ok great, let me know how you’re getting on and whether it’s just that simple change you had previously

from node-decorators.

Related Issues (20)

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.