Fn project is missing http operations (CRUD)
I have spent my afternoon getting very excited about the container-native serverless platform 'fn project' - http://fnproject.io/.
I love the idea of the FaaS model but have no intention of locking myself into a particular cloud vendor for most of the lifetime of an app - and several other reasons including the desire to spin up the entire app on a small server anywhere if I choose.
fn project seems great for my needs until I finish perusing the documentation and all the relevant blog posts and suddenly think 'what? Wait....what??? Where are the http operations?'.
I cannot find a single reference anywhere that states if it is even possible to to have http triggers for different http operations (ie POST, PUT, PATCH, DELETE), let alone how I would do it.
I want to build REST api's (or certainly at the very least json-serving http-based RPC apis - if it doesn't have hypermedia links it isn't REST ;) but let's not get into that one in this thread)
Am I missing something here (certainly the correct bit of documentation)??
Can anybody please enlighten me as to how I would do this, or even tell me if I have totally misunderstood what I should use this for?
My excitement has gone soft for now but I'm hoping someone that will change with the right information.
It feels odd that I can't find anyone else complaining about this, so I think that indicates my misunderstanding perhaps.
Other solutions such as OpenFaaS look interesting but I dont wan't to have to learn how to deploy kubernetes and docker swarms if I can avoid it :)
docker faas fn openfaas
add a comment |
I have spent my afternoon getting very excited about the container-native serverless platform 'fn project' - http://fnproject.io/.
I love the idea of the FaaS model but have no intention of locking myself into a particular cloud vendor for most of the lifetime of an app - and several other reasons including the desire to spin up the entire app on a small server anywhere if I choose.
fn project seems great for my needs until I finish perusing the documentation and all the relevant blog posts and suddenly think 'what? Wait....what??? Where are the http operations?'.
I cannot find a single reference anywhere that states if it is even possible to to have http triggers for different http operations (ie POST, PUT, PATCH, DELETE), let alone how I would do it.
I want to build REST api's (or certainly at the very least json-serving http-based RPC apis - if it doesn't have hypermedia links it isn't REST ;) but let's not get into that one in this thread)
Am I missing something here (certainly the correct bit of documentation)??
Can anybody please enlighten me as to how I would do this, or even tell me if I have totally misunderstood what I should use this for?
My excitement has gone soft for now but I'm hoping someone that will change with the right information.
It feels odd that I can't find anyone else complaining about this, so I think that indicates my misunderstanding perhaps.
Other solutions such as OpenFaaS look interesting but I dont wan't to have to learn how to deploy kubernetes and docker swarms if I can avoid it :)
docker faas fn openfaas
add a comment |
I have spent my afternoon getting very excited about the container-native serverless platform 'fn project' - http://fnproject.io/.
I love the idea of the FaaS model but have no intention of locking myself into a particular cloud vendor for most of the lifetime of an app - and several other reasons including the desire to spin up the entire app on a small server anywhere if I choose.
fn project seems great for my needs until I finish perusing the documentation and all the relevant blog posts and suddenly think 'what? Wait....what??? Where are the http operations?'.
I cannot find a single reference anywhere that states if it is even possible to to have http triggers for different http operations (ie POST, PUT, PATCH, DELETE), let alone how I would do it.
I want to build REST api's (or certainly at the very least json-serving http-based RPC apis - if it doesn't have hypermedia links it isn't REST ;) but let's not get into that one in this thread)
Am I missing something here (certainly the correct bit of documentation)??
Can anybody please enlighten me as to how I would do this, or even tell me if I have totally misunderstood what I should use this for?
My excitement has gone soft for now but I'm hoping someone that will change with the right information.
It feels odd that I can't find anyone else complaining about this, so I think that indicates my misunderstanding perhaps.
Other solutions such as OpenFaaS look interesting but I dont wan't to have to learn how to deploy kubernetes and docker swarms if I can avoid it :)
docker faas fn openfaas
I have spent my afternoon getting very excited about the container-native serverless platform 'fn project' - http://fnproject.io/.
I love the idea of the FaaS model but have no intention of locking myself into a particular cloud vendor for most of the lifetime of an app - and several other reasons including the desire to spin up the entire app on a small server anywhere if I choose.
fn project seems great for my needs until I finish perusing the documentation and all the relevant blog posts and suddenly think 'what? Wait....what??? Where are the http operations?'.
I cannot find a single reference anywhere that states if it is even possible to to have http triggers for different http operations (ie POST, PUT, PATCH, DELETE), let alone how I would do it.
I want to build REST api's (or certainly at the very least json-serving http-based RPC apis - if it doesn't have hypermedia links it isn't REST ;) but let's not get into that one in this thread)
Am I missing something here (certainly the correct bit of documentation)??
Can anybody please enlighten me as to how I would do this, or even tell me if I have totally misunderstood what I should use this for?
My excitement has gone soft for now but I'm hoping someone that will change with the right information.
It feels odd that I can't find anyone else complaining about this, so I think that indicates my misunderstanding perhaps.
Other solutions such as OpenFaaS look interesting but I dont wan't to have to learn how to deploy kubernetes and docker swarms if I can avoid it :)
docker faas fn openfaas
docker faas fn openfaas
asked Dec 28 '18 at 10:57
gezinspacegezinspace
309418
309418
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
I'm not an expert, but as of now it seems not possible to specify the http method inside the trigger. Check latest trigger spec : as you can see, there is no notion of http
method here.
However, handling different HTTP methods can be done inside the function itself.
For example, in Java (with fdk-java
v1.0.80), you can use com.fnproject.fn.api.httpgateway.HTTPGatewayContext
as the first parameter of the function, as described in the section "Accessing HTTP Information From Functions" of the documentation :
In Fn for Java, when your function is being served by an HTTP trigger (or another compatible HTTP gateway) you can get access to both the incoming request headers for your function by adding a 'com.fnproject.fn.api.httpgateway.HTTPGatewayContext' parameter to your function's parameters.
Using this allows you to :
- ...
Access the method and request URL for the trigger
- ...
You can then retrieve the HTTP method by calling getMethod()
on the HTTPGatewayContext
passed as parameter.
In other languages (with others fdk), it's possible to do the same :
- in Go : example calling
RequestMethod()
on context
- in Ruby : class
HTTPContext
- in Python : class
HTTPGatewayContext
- in Node : class
HTTPGatewayContext
From this different contexts, you'll then be able to get method
parameter passed when fn invoke --method=[GET|POST|...]
(via fn-http-method
header).
The main drawback here is that all HTTP methods should be handled in the same function. Nonetheless, you can structure your code to have only one class per method.
Thankyou norbdj -- you have basically confirmed the conclusions I had eventually reached. I was REALLY hoping that i was wrong because, as I'm sure you would agree, it kind of undoes so much of the hard work done to decouple functionality at such a granular level in the first place. Thanks so much for your input and it certainly serves a great reference to anybody who is feeling the same.
– gezinspace
Dec 28 '18 at 12:42
add a comment |
After some further thought it seems fairly clear now what my actual misunderstanding was....
When I have built Serverless framework services in the past (or built and deployed Lambda functions using terraform) I have been deploying to AWS and so have been using AWS's API Gateway offering (their product is actually called API gateway but its important to recognise that API Gateway is a distributed systems / micro-sevices design pattern).
API gateway makes it possible to route specific http request types including the method (GET,POST,PUT,DELETE) to the desired functions.
Platforms such as Fn project and OpenFaaS do not provide an out of the box api gateway solution and it seems we would need to take care of this ourselves.
These above mentioned platforms are about deployment of functions. We find the other bits via our product of choice.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53957422%2ffn-project-is-missing-http-operations-crud%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'm not an expert, but as of now it seems not possible to specify the http method inside the trigger. Check latest trigger spec : as you can see, there is no notion of http
method here.
However, handling different HTTP methods can be done inside the function itself.
For example, in Java (with fdk-java
v1.0.80), you can use com.fnproject.fn.api.httpgateway.HTTPGatewayContext
as the first parameter of the function, as described in the section "Accessing HTTP Information From Functions" of the documentation :
In Fn for Java, when your function is being served by an HTTP trigger (or another compatible HTTP gateway) you can get access to both the incoming request headers for your function by adding a 'com.fnproject.fn.api.httpgateway.HTTPGatewayContext' parameter to your function's parameters.
Using this allows you to :
- ...
Access the method and request URL for the trigger
- ...
You can then retrieve the HTTP method by calling getMethod()
on the HTTPGatewayContext
passed as parameter.
In other languages (with others fdk), it's possible to do the same :
- in Go : example calling
RequestMethod()
on context
- in Ruby : class
HTTPContext
- in Python : class
HTTPGatewayContext
- in Node : class
HTTPGatewayContext
From this different contexts, you'll then be able to get method
parameter passed when fn invoke --method=[GET|POST|...]
(via fn-http-method
header).
The main drawback here is that all HTTP methods should be handled in the same function. Nonetheless, you can structure your code to have only one class per method.
Thankyou norbdj -- you have basically confirmed the conclusions I had eventually reached. I was REALLY hoping that i was wrong because, as I'm sure you would agree, it kind of undoes so much of the hard work done to decouple functionality at such a granular level in the first place. Thanks so much for your input and it certainly serves a great reference to anybody who is feeling the same.
– gezinspace
Dec 28 '18 at 12:42
add a comment |
I'm not an expert, but as of now it seems not possible to specify the http method inside the trigger. Check latest trigger spec : as you can see, there is no notion of http
method here.
However, handling different HTTP methods can be done inside the function itself.
For example, in Java (with fdk-java
v1.0.80), you can use com.fnproject.fn.api.httpgateway.HTTPGatewayContext
as the first parameter of the function, as described in the section "Accessing HTTP Information From Functions" of the documentation :
In Fn for Java, when your function is being served by an HTTP trigger (or another compatible HTTP gateway) you can get access to both the incoming request headers for your function by adding a 'com.fnproject.fn.api.httpgateway.HTTPGatewayContext' parameter to your function's parameters.
Using this allows you to :
- ...
Access the method and request URL for the trigger
- ...
You can then retrieve the HTTP method by calling getMethod()
on the HTTPGatewayContext
passed as parameter.
In other languages (with others fdk), it's possible to do the same :
- in Go : example calling
RequestMethod()
on context
- in Ruby : class
HTTPContext
- in Python : class
HTTPGatewayContext
- in Node : class
HTTPGatewayContext
From this different contexts, you'll then be able to get method
parameter passed when fn invoke --method=[GET|POST|...]
(via fn-http-method
header).
The main drawback here is that all HTTP methods should be handled in the same function. Nonetheless, you can structure your code to have only one class per method.
Thankyou norbdj -- you have basically confirmed the conclusions I had eventually reached. I was REALLY hoping that i was wrong because, as I'm sure you would agree, it kind of undoes so much of the hard work done to decouple functionality at such a granular level in the first place. Thanks so much for your input and it certainly serves a great reference to anybody who is feeling the same.
– gezinspace
Dec 28 '18 at 12:42
add a comment |
I'm not an expert, but as of now it seems not possible to specify the http method inside the trigger. Check latest trigger spec : as you can see, there is no notion of http
method here.
However, handling different HTTP methods can be done inside the function itself.
For example, in Java (with fdk-java
v1.0.80), you can use com.fnproject.fn.api.httpgateway.HTTPGatewayContext
as the first parameter of the function, as described in the section "Accessing HTTP Information From Functions" of the documentation :
In Fn for Java, when your function is being served by an HTTP trigger (or another compatible HTTP gateway) you can get access to both the incoming request headers for your function by adding a 'com.fnproject.fn.api.httpgateway.HTTPGatewayContext' parameter to your function's parameters.
Using this allows you to :
- ...
Access the method and request URL for the trigger
- ...
You can then retrieve the HTTP method by calling getMethod()
on the HTTPGatewayContext
passed as parameter.
In other languages (with others fdk), it's possible to do the same :
- in Go : example calling
RequestMethod()
on context
- in Ruby : class
HTTPContext
- in Python : class
HTTPGatewayContext
- in Node : class
HTTPGatewayContext
From this different contexts, you'll then be able to get method
parameter passed when fn invoke --method=[GET|POST|...]
(via fn-http-method
header).
The main drawback here is that all HTTP methods should be handled in the same function. Nonetheless, you can structure your code to have only one class per method.
I'm not an expert, but as of now it seems not possible to specify the http method inside the trigger. Check latest trigger spec : as you can see, there is no notion of http
method here.
However, handling different HTTP methods can be done inside the function itself.
For example, in Java (with fdk-java
v1.0.80), you can use com.fnproject.fn.api.httpgateway.HTTPGatewayContext
as the first parameter of the function, as described in the section "Accessing HTTP Information From Functions" of the documentation :
In Fn for Java, when your function is being served by an HTTP trigger (or another compatible HTTP gateway) you can get access to both the incoming request headers for your function by adding a 'com.fnproject.fn.api.httpgateway.HTTPGatewayContext' parameter to your function's parameters.
Using this allows you to :
- ...
Access the method and request URL for the trigger
- ...
You can then retrieve the HTTP method by calling getMethod()
on the HTTPGatewayContext
passed as parameter.
In other languages (with others fdk), it's possible to do the same :
- in Go : example calling
RequestMethod()
on context
- in Ruby : class
HTTPContext
- in Python : class
HTTPGatewayContext
- in Node : class
HTTPGatewayContext
From this different contexts, you'll then be able to get method
parameter passed when fn invoke --method=[GET|POST|...]
(via fn-http-method
header).
The main drawback here is that all HTTP methods should be handled in the same function. Nonetheless, you can structure your code to have only one class per method.
answered Dec 28 '18 at 12:20
norbjdnorbjd
1,5021622
1,5021622
Thankyou norbdj -- you have basically confirmed the conclusions I had eventually reached. I was REALLY hoping that i was wrong because, as I'm sure you would agree, it kind of undoes so much of the hard work done to decouple functionality at such a granular level in the first place. Thanks so much for your input and it certainly serves a great reference to anybody who is feeling the same.
– gezinspace
Dec 28 '18 at 12:42
add a comment |
Thankyou norbdj -- you have basically confirmed the conclusions I had eventually reached. I was REALLY hoping that i was wrong because, as I'm sure you would agree, it kind of undoes so much of the hard work done to decouple functionality at such a granular level in the first place. Thanks so much for your input and it certainly serves a great reference to anybody who is feeling the same.
– gezinspace
Dec 28 '18 at 12:42
Thankyou norbdj -- you have basically confirmed the conclusions I had eventually reached. I was REALLY hoping that i was wrong because, as I'm sure you would agree, it kind of undoes so much of the hard work done to decouple functionality at such a granular level in the first place. Thanks so much for your input and it certainly serves a great reference to anybody who is feeling the same.
– gezinspace
Dec 28 '18 at 12:42
Thankyou norbdj -- you have basically confirmed the conclusions I had eventually reached. I was REALLY hoping that i was wrong because, as I'm sure you would agree, it kind of undoes so much of the hard work done to decouple functionality at such a granular level in the first place. Thanks so much for your input and it certainly serves a great reference to anybody who is feeling the same.
– gezinspace
Dec 28 '18 at 12:42
add a comment |
After some further thought it seems fairly clear now what my actual misunderstanding was....
When I have built Serverless framework services in the past (or built and deployed Lambda functions using terraform) I have been deploying to AWS and so have been using AWS's API Gateway offering (their product is actually called API gateway but its important to recognise that API Gateway is a distributed systems / micro-sevices design pattern).
API gateway makes it possible to route specific http request types including the method (GET,POST,PUT,DELETE) to the desired functions.
Platforms such as Fn project and OpenFaaS do not provide an out of the box api gateway solution and it seems we would need to take care of this ourselves.
These above mentioned platforms are about deployment of functions. We find the other bits via our product of choice.
add a comment |
After some further thought it seems fairly clear now what my actual misunderstanding was....
When I have built Serverless framework services in the past (or built and deployed Lambda functions using terraform) I have been deploying to AWS and so have been using AWS's API Gateway offering (their product is actually called API gateway but its important to recognise that API Gateway is a distributed systems / micro-sevices design pattern).
API gateway makes it possible to route specific http request types including the method (GET,POST,PUT,DELETE) to the desired functions.
Platforms such as Fn project and OpenFaaS do not provide an out of the box api gateway solution and it seems we would need to take care of this ourselves.
These above mentioned platforms are about deployment of functions. We find the other bits via our product of choice.
add a comment |
After some further thought it seems fairly clear now what my actual misunderstanding was....
When I have built Serverless framework services in the past (or built and deployed Lambda functions using terraform) I have been deploying to AWS and so have been using AWS's API Gateway offering (their product is actually called API gateway but its important to recognise that API Gateway is a distributed systems / micro-sevices design pattern).
API gateway makes it possible to route specific http request types including the method (GET,POST,PUT,DELETE) to the desired functions.
Platforms such as Fn project and OpenFaaS do not provide an out of the box api gateway solution and it seems we would need to take care of this ourselves.
These above mentioned platforms are about deployment of functions. We find the other bits via our product of choice.
After some further thought it seems fairly clear now what my actual misunderstanding was....
When I have built Serverless framework services in the past (or built and deployed Lambda functions using terraform) I have been deploying to AWS and so have been using AWS's API Gateway offering (their product is actually called API gateway but its important to recognise that API Gateway is a distributed systems / micro-sevices design pattern).
API gateway makes it possible to route specific http request types including the method (GET,POST,PUT,DELETE) to the desired functions.
Platforms such as Fn project and OpenFaaS do not provide an out of the box api gateway solution and it seems we would need to take care of this ourselves.
These above mentioned platforms are about deployment of functions. We find the other bits via our product of choice.
answered Dec 29 '18 at 13:05
gezinspacegezinspace
309418
309418
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53957422%2ffn-project-is-missing-http-operations-crud%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown