A starter example that shows how to use RedwoodJS with Netlify Edge Functions.
The example shows how geolocation through the Netlify Edge Functions can be used to determine what page needs to be rendered for each region. For example, if you are from the US, you might get some hints as to what is football and what is not.
Visit https://redwood-with-edge-demo.netlify.app/ to see the code in this repository in action.
- RedwoodJS requires Node.js (>=14.19.x <=16.x) and Yarn (>=1.15) installed.
- Using Netlify Edge Functions locally requires the Netlify CLI installed.
To get stated with local development, follow the instructions below in your terminal application:
-
Clone this repository locally:
git clone https://github.com/ericapisani/sample-redwoodjs-with-edge-netlify
-
Navigate to the repository folder:
cd sample-redwoodjs-with-edge-netlify
-
Install the package dependencies:
yarn install
-
Start the application using the Netlify CLI (this will ensure that the Edge Function is executed as well):
netlify dev
If the command is successful, you should see a new browser window open with the application running locally.
To deploy the project to Netlify, make sure that you have the Netlify CLI installed. You can install the Netlify CLI globally by running this command in the terminal:
npm install netlify-cli -g
Once the CLI is installed, run the deployment command in the terminal:
netlify deploy --build
Once the command is executed, you'll be prompted for information about the site where the code needs to be deployed.
If the command is successful, you should see a URL to your site in the terminal.
If you found an issue with the code in this repository, feel free to open an issue or let us know in the Netlify Forums.