UNPKG

fwsp-hydra-express

Version:

A module which wraps Hydra and ExpressJS to provide an out of the box microservice which can support API routes and handlers.

22 lines (18 loc) 475 B
const hydraExpress = require('../index'); const express = hydraExpress.getExpress(); let api = express.Router(); const HTTP_OK = 200; /** * @description Answer the hello call. * @param {function} route handler */ api.get('/greeting', (req, res) => { let hydra = hydraExpress.getHydra(); let serviceName = hydra.getServiceName(); hydraExpress.sendResponse(HTTP_OK, res, { result: { message: `Hello from ${serviceName}` } }); }); module.exports = api;