This guide shows you how to deploy a Razzle application to Edgio.
This framework has a connector developed for Edgio. See Connectors for more information.
Before proceeding, you will need an Edgio property. Create one now if you do not already have one.
Deploying requires an account on Edgio. Sign up here for free.
If you have not already done so, install the Edgio CLI.
1npm i -g @edgio/cli@latest
To prepare your Razzle app for deployment on Edgio, run the following in the root folder of your project:
1edgio init --edgioVersion latest
This will automatically add all of the required dependencies and files to your project. These include:
@edgio/corepackage - Allows you to declare routes and deploy your application on Edgio
@edgio/razzlepackage - Provides router middleware that automatically adds Razzle routes to Edgio router.
@edgio/prefetchpackage - Allows you to configure a service worker to prefetch and cache pages to improve browsing speed
@edgio/reactpackage - Provides a
Prefetchcomponent for prefetching pages
routes.js- A default routes file that sends all requests to Razzle. Update this file to add caching or proxy some URLs to a different origin.
sw/service-worker.js- The source code for your service worker, which enables prefetching when running on Edgio.
edgio.config.js- Contains configuration options for deploying on Edgio.
Test your app with the Sites on your local machine by running the following command in your project’s root directory:
To simulate edge caching locally, run:
1edgio dev --cache
Deploy your app to the Sites by running the following command in your project’s root directory:
Your initial CDN-as-code deployment will generate system-defined origin configurations along with those defined within your
edgio.config.js. Learn more about system-defined origins.
See Deployments for more information.