This sample code accompanies a tutorial on using Squid Cloud with Next.js and Netlify. For complete details, check out the tutorial.
- Install the Squid CLI using the following command:
npm install -g @squidcloud/cli- Install the Netlify CLI using the following command:
npm install -g netlify-cli-
Navigate to the Squid Console and create a new application named
notes-app. -
In the Squid Console, navigate to the application overview page and scroll to the Backend project section. Click Create .env file and copy the command.
-
Change to the backend directory.
cd notes-app/backend- Create the
.envfile using the command you copied from the console. The command has the following format:
squid init-env \
--appId YOUR_APP_ID \
--apiKey YOUR_API_KEY \
--environmentId dev \
--squidDeveloperId YOUR_SQUID_DEVELOPER_KEY \
--region us-east-1.aws- Install the required dependencies:
npm install- Open a new terminal window and navigate to the notes app frontend. You should now have two open terminal windows: one for the app's backend and one for the frontend.
cd notes-app/frontend- Install the required dependencies:
npm install- Create the Netlify project:
netlify sites:create- Create a file called
.env.localand replace the placeholder in the file with your Squid developer ID. You can find the ID in the.envfile of your backend and in the Squid Cloud Console.
touch .env.localSQUID_DEVELOPER_ID=[YOUR_SQUID_DEVELOPER_ID]- Open the
netlify.tomlfile. Replace the placeholder with your app ID. The app ID is found in the.envfile of your backend and in the Squid Cloud Console.
...
SQUID_APP_ID = "YOUR_APP_ID"
...