vgjohn / totoro Goto Github PK
View Code? Open in Web Editor NEWNode.js API Versioning Helper Module
License: MIT License
Node.js API Versioning Helper Module
License: MIT License
@lexod @melnele
Your PRs #4 removed the endpoint.apiVersion
parameter from the implementation syntax.
Doing this would break previous applications therefore I am reverting to the old syntax for writing the implementation:
implementation = (apiVersion, req, res, next) => {
// do something
};
Also, please README.md
for further information.
router.post('/' + endpoint.apiVersion + endpoint.endpoint, urlencodedParser, function(req, res) {
endpoint.endpointConfig.endpointImplementation(endpoint.apiVersion, req, res);
});
In current implementation of totoro next function is not considered. If we add next parameter in endpointImplemenation(actual function) then it shows undefined. If we need to pass error to global error handler we need next in endpointImplementation.
To handle this, we can change the code to
router.post('/' + endpoint.apiVersion + endpoint.endpoint, urlencodedParser, function(req, res, next) {
endpoint.endpointConfig.endpointImplementation(endpoint.apiVersion, req, res, next);
});
That will help to call global error handler.
Hi,
How to integrate swagger into totoro routes. I'm using
"swagger-autogen": "^2.18.8",
"swagger-ui-express": "^4.3.0"
Thanks
I've used this package before and I would like to become a maintainer for this project. I will ensure regular updates.
I noticed that totoro-node
uses an old version of js-yaml
that carries with it 2 vulnerabilities.
Bumping the version to >=3.13.1
should fix it.
I noticed that totoro-node
uses winston as the default logger. I am using morgan with a cusotm config and I would like if it can use my logger. Adding a feature to use other loggers would be useful.
Hello
app.use('/', totoro.rain({
1: {
// COMMENTS
deprecated: true,
"/functions/getComments": {
method: "POST",
endpointImplementation: test
},
"/functions/setComment": {
method: "POST",
endpointImplementation: test
}
},
2: {
"/comments": {
method: "GET",
endpointImplementation: test
},
"/comments": {
method: "POST",
endpointImplementation: test
}
}
}));
It seems it impossible to do this, it will create only the V2 POST route ๐ข
debug: Adding routes for API version 1
debug: Adding route 'POST /1/functions/getComments'
debug: Adding route 'POST /1/functions/setComment'
debug:
debug: Adding routes for API version 2
debug: Adding route 'POST /2/comments'
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.