Giter Site home page Giter Site logo

Comments (3)

imrefazekas avatar imrefazekas commented on May 18, 2024 1

Simple aim. To free the business logic from the signature of underlaying layers.
If you combine connect-rest with other libraries, you can write your business logic functions once and can use them in a REST or Websocket or message bus calls without any changes or wrapping and without carrying about the signatures of different libraries. I write many enterprise apps servicing through different interfaces...
That is the reason why I wrote connect-rest, otherwise it would be just another feature-full REST library.
I believe express and restify are doing a great job on that road you are seeking.

Feel free to fork connect-rest if you want to mutate it down to connect-level.

from connect-rest.

imrefazekas avatar imrefazekas commented on May 18, 2024

Dear Ronald,

As I tried to describe here: https://github.com/imrefazekas/connect-rest#rest-functions
connect-rest is not a "middleware-only" solution. How it works:
matches the call against all paths defined by the developer and if nothing matches that next function will be called automatically. In case of matching, your matching service-like function or functions will be called.

You can have multiple service functions to the same path or a wide range of options (please check documentation for details) to orchestrate your business logic as you wish. But as you observed, connect-rest does not follow the path of "middlewares", it serves a different purpose and aim.

I'm sure, you find your voice with connect-rest but if not, lots of REST solutions are built to be a "middleware" only.

from connect-rest.

RonaldTreur avatar RonaldTreur commented on May 18, 2024

I know it currently doesn't work that way, but I'm not sure why you would not want to make it pure middleware? I'm also not sure what you mean by "middleware-only". It is connect middleware right? It says so everywhere in the readme.

I actually made a few changes to your code that makes everything work correctly. It might break some other functionality I am not aware of however, I'm not 100% sure.
If you want I can make a PR and you can take a look.

from connect-rest.

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.