The default Gatsby Starter template, and additional scripts for deployment to Dark.
git clone [email protected]:aashanand/gatsby-dark-starter.git
cd gatsby-dark-starter
To start, first set up some environment variables.
export DARK_STATIC_ASSETS_BASE_URL='replace-with-your-canvas-name';
export DARK_USERNAME='replace-with-your-dark-username';
export DARK_PASSWORD='replace-with-your-dark-password';
Then, there are just four more steps before you're in business.
npm run build-dark-assets
You only need to do this once per project. Every other time, you can skip to the next step.
npm run get-dark-cli
npm run deploy
If you get "Not Found" on this step, you need to visit https://darklang.com/a/USERNAME-CANVASNAME first in your browser.
- Go to https://darklang.com/a/USERNAME-CANVASNAME
- Create a new
HTTP GEThandler with route/. For the handler expression, useStaticAssets:serveLatest->"index.html". - Create a new
HTTP GEThandler with route/:rest. For the handler expression, useStaticAssets:serveLatest->rest. Due to some peculiarities in how Dark prefers to serveJSONfiles, we need to serve them with a separate function.
Like so.
Demo lives here.
