openfaas-incubator / node10-express-template Goto Github PK
View Code? Open in Web Editor NEWNode.js 10 Express Template for OpenFaaS
License: MIT License
Node.js 10 Express Template for OpenFaaS
License: MIT License
Hi, I was trying to use this template to serve SPA files. I was following the article https://www.openfaas.com/blog/serverless-single-page-app/ . It works well except for images and I suspect for contents such as pdf. I tried modifying the template to use express' sendFile()
and setting the right Content-Type
and it works with that. However, I was not able to succeed sending files with either end()
or pipe()
. If there is an alternative without modifying the template, please let me know. Based on the suggestion, I can also make a pull request to correct the issue. Thanks in advance.
The following code snippet should return a 501 status code along with the error message.
module.exports = (event, context) => {
context
.status(501)
.fail('An error occurred');
}
The snippet is returning the default 500 status code along with the error message.
Modify the fail method inside index.js to use this.value
fail(value) {
let message;
this.cb(this.value, message);
}
Create a handler that returns the following
module.exports = (event, context) => {
context
.status(501)
.fail('An error occurred');
}
I am trying to create a stateless microservice that returns proper status codes.
faas-cli version: 0.8.3
docker version: 18.09.1
OS: MacOS
I am using kafka-connector to trigger a function but the body is always empty. I set RAW_BODY
to true
but it is still empty.
Is there another way I can try to solve this issues ?
here is the log of the function request:
{
"body": {},
"headers": {
"host": "transform.openfaas-fn.svc.cluster.local:8080",
"user-agent": "Go-http-client/1.1",
"transfer-encoding": "chunked",
"accept-encoding": "gzip",
"x-forwarded-for": "10.244.0.193:58756",
"x-forwarded-host": "gateway.openfaas:8080"
},
"method": "POST",
"query": {},
"path": "/"
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.