-
Notifications
You must be signed in to change notification settings - Fork 2
custom
Deva Kumar edited this page Apr 27, 2022
·
3 revisions
obsolete viya-appserverjs routes can be extended with custom routes. Create a new entry (app.js) and start the server with the following command
node app --env=overrides.env --docker=Dockerfile --appenv=appenv.js
let restafServer = require('@sassoftware/viya-appserverjs');
let customRoutes = getCustomRoutes();
restafServer.icli(customRoutes)
function getCustomRoutes() {
... define routes following the documentation in hapijs
... https://hapi.dev/api/?v=19.1.1
};
let restafServer = require('@sassoftware/viya-appserverjs');
let customRoutes = getCustomRoutes();
restafServer.icli(customRoutes)
function getCustomRoutes () {
let handler = [
{
method: ['GET'],
path : `/getDB`,
config: {
auth : false,
cors : true,
handler: getDB
}
},
{
method: [ 'POST' ],
path: `/updateDB`,
config: {
auth: false,
cors: true,
handler: updateDB
}
}
];
return handler;
}
async function getDB (req, h) {
return 'in getDB';
}
async function updateDB (req, h) {
return 'in updateDB';
}