How to make a custom API without a model and expose it via the explorer

51 views
Skip to first unread message

Kevin Clark

unread,
Jan 9, 2018, 4:53:43 PM1/9/18
to LoopbackJS
There are often times we might want to make a API and not expose it via a model.

For example,


I have defined a custom express method in the routes.js file.

module.exports = function(server) {
// Install a `/` route that returns server status
var router = server.loopback.Router();
router.get('/', server.loopback.status());
router.get('/sys-health', server.loopback.status());
server.use(router);
};

This path is required by dev ops teams. 

I want to expose the custom API in the /explorer

Additionally, I want to create a swagger file that will contain my model paths I see in the /explorer and custom paths I define.

How would one do this?

Thanks
Kevin


Francois Laforge

unread,
Feb 16, 2018, 9:53:04 AM2/16/18
to LoopbackJS
Reply all
Reply to author
Forward
0 new messages