-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Netlify function support (init. version)
This commit attempts to set up netlify function support, it has hello.js example. One big issue is that the nelify functions are essentially only work on :9000, which is a different port (8000) then what gatsby run in develop mode. I need to fix this, not sure how atm.
- Loading branch information
1 parent
01cad74
commit 513c819
Showing
7 changed files
with
253 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[build] | ||
publish = "public" | ||
command = "npm run build" | ||
functions = "lambda" | ||
[build.environment] | ||
YARN_VERSION = "1.9.4" | ||
YARN_FLAGS = "--no-ignore-optional" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// For more info, check https://www.netlify.com/docs/functions/#javascript-lambda-functions | ||
export function handler(event, context, callback) { | ||
console.log("queryStringParameters", event.queryStringParameters) | ||
callback(null, { | ||
// return null to show no errors | ||
statusCode: 200, // http status code | ||
body: JSON.stringify({ | ||
msg: "Hello, World! " + Math.round(Math.random() * 10), | ||
}), | ||
}) | ||
} | ||
|
||
// Now you are ready to access this API from anywhere in your Gatsby app! For example, in any event handler or lifecycle method, insert: | ||
// fetch("/.netlify/functions/hello") | ||
// .then(response => response.json()) | ||
// .then(console.log) | ||
// For more info see: https://www.gatsbyjs.org/blog/2018-12-17-turning-the-static-dynamic/#static-dynamic-is-a-spectrum |
Oops, something went wrong.