
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
openfaas-node-multiarch
Advanced tools
A multi-arch template for running Node and TypeScript applications on OpenFAAS
This package is purely to provide the TypeScript interfaces for use in the functions.
This template is designed as a drop-in replacement for the official Node12 template in the OpenFAAS store. It should be considered as an improvement to that template, offering the following:
Interfaces are published to npm
under the openfaas-node-multiarch
package.
A tsconfig.json
file is included for convenience. However, as TypeScript building is
handled by the Docker image, this should only be used for local running.
In the official Node12 template, you must return context.succeed(response)
to
send data outwards. Whilst I have no issue with that in itself, it can make testing
a little harder than it needs to be. For that reason, any value returned, resolved
or rejected from the function is treated as the response.
There are no performance differences as the methods are just syntactic sugar, allowing personal preference to be the differentiator.
These all result in the same output:
// Successful execution
module.exports = (event, context) => {
context.httpHeaders = {
'content-type': 'application/json',
};
context.httpStatus = 403
return { hello: 'world' };
};
module.exports = (event, context) => context
.headers({
'content-type': 'application/json',
})
.status(403)
.succeed({ hello: 'world' });
// Failed execution
module.exports = () => {
throw new Error('some error');
};
module.exports = (event, context) => context
.fail(new Error('some error'));
This must be set to handler.js
module.exports = (event, context) => {
const response = {
status: `Received input js: ${JSON.stringify(event.body)}`,
};
return context
.status(200)
.succeed(response);
};
This must be set to tsHandler.ts
import { IFunctionContext, IFunctionEvent } from 'openfaas-node-multiarch';
export default (event: IFunctionEvent, context: IFunctionContext) => {
const response = {
status: `Received input: ${JSON.stringify(event.body)}`,
};
return context
.status(200)
.succeed(response);
};
FAQs
Multi-arch OpenFaaS template for NodeJS
The npm package openfaas-node-multiarch receives a total of 416 weekly downloads. As such, openfaas-node-multiarch popularity was classified as not popular.
We found that openfaas-node-multiarch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.