I am wondering how one could deploy the Node.js app for Azure Functions.
Basically, I have the function set up and run the main http hello world example, which looks like this:
module.exports = function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
context.res = {
body: "Hello " + req.params.name
};
context.done();
};
The application I'm trying to deploy to a function is a simple moc client that uses swagger (basically it accepts the request and returns some xml). App.js looks like this:
const SwaggerExpress = require('swagger-express-mw');
const app = require('express')();
const compression = require('compression');
const configSwagger = {
appRoot: __dirname,
};
SwaggerExpress.create(configSwagger, (err, swaggerExpress) => {
if (err) {
throw err;
}
swaggerExpress.register(app);
const serverPort = process.env.PORT || 3001;
app.listen(serverPort, () => {
});
app.use(compression());
});
module.exports = app;
That I'm not sure how to handle module.exports = application when modeul.exports is used to set a function (i.e. module.exports = function (context, req))
source
share