Comments (3)
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.
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.
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)
- Having a problem with path resolution HOT 3
- Domain on 'error' event listener HOT 8
- protectors should allow returning 400/401/403 responses. HOT 4
- ES6 Array prototype functions are enumerable
- Missing: HTTP OPTIONS method HOT 5
- About the support for the "cors" Node module HOT 2
- SyntaxError: Unexpected strict mode reserved word HOT 2
- Setting header in options doesn't work HOT 1
- Allow discover without api key? HOT 1
- rest.rester( options ) still supprted? HOT 6
- Setting context: '/' causes issues with URL HOT 6
- Hello world example needed sorely HOT 3
- Headers have not returning HOT 1
- error TypeError: rest.publish is not a function
- Older versions documentation
- undefined result hangs HOT 3
- Get TypeError: cb is not a function
- 【bug】TypeError: winston.Logger is not a constructor HOT 2
- Axios dependency has server-side request forgery vulnerability HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connect-rest.