Closed abdullateef97 closed 6 years ago
@mjrdnk where do i add the usage
For usage write a snippet for server.js and route for this controller. So only in README file we need something like this:
Examples:
Example: nexmo - sms service To write your custom controllers write your functions in the file and export the module:
here goes controller for nexmo
so the controller could be reused in router file nexmo.route.js, like this (please check other helloWorld route for implementation):
here goes route for nexmo
In order to use it in your app you have to declare it in the server.js, like this:
...
let API_BASE = config.API_BASE;
let helloWorld = require('./routes/helloWorld.js');
let nexmo = require('./routes/nexmo.route.js');
app.use(function(req, res, next) {
...
...
}));
app.use(API_BASE, helloWorld);
app.use(API_BASE, nexmo);
app.listen(port, function() {
...
After that, your new nexmo route will be available in the REST call.
If you have further questions, please ask.
everything shd be in the readme file
Yes, this use case (nexmo) is so specific that it's place should be in the README examples section. However it would be the best to have some more generic example, but I will accept it anyway.
@mjrdnk i believe my new commit should meet your specs
Just saw that markup is broken after merging. Please fix.
can u specify what part
I fixed it already. Thanks for your contribution 😊
added a nexmo module to controller, it allows u send sms using the nexmo platform