On wild-slider-cms
Execute
cp .env.example .envYou must have a Mongodb.com account and AWS S3 Bucket
Set up your .env
DATABASE_URI=mongodb+srv://<user>:<password>@cluster0.vbxof.mongodb.net/<dbname>?retryWrites=true&w=majorityDATABASE_URI=YOUR_MONGO_DATABASE_URIDATABASE_NAME=YOUR_DATABASE_NAMEAWS_API_ID=YOUR_AWS_S3_IDAWS_API_KEY=YOUR_AWS_S3_KEYAWS_API_REGION=YOUR_AWS_API_REGIONAWS_BUCKET_NAME=YOUR_AWS_BUCKET_NAME
Execute
cd wild-slider-cms
yarn # or: npm run install
yarn develop # or: npm run developThis will open http://localhost:1337/ and prompt you to create an admin user.
From Content-Types, Entries.
-
Click on button
Add new entries. -
Click on cover image and upload assets from
sliderfolder -
Select an Image for entry
-
Write a caption and press Save and Publish button
-
Repeat this 3 times for others Images
From Settings & Roles, edit the Public role.
Then select: count, find, and findone permissions for Entries. Click Save.
While the Strapi server is running, open a new terminal and cd into the Next.js app directory you created earlier.
cd wild-slider-frontend
Copy the .env.local.example file in this directory to .env.local (which will be ignored by Git):
cp .env.local.example .env.localThen set each variable on .env.local:
STRAPI_PREVIEW_SECRETcan be any random string (but avoid spaces), likeMY_SECRET- this is used for Preview Mode.NEXT_PUBLIC_STRAPI_API_URLshould be set ashttp://localhost:1337(no trailing slash).NEXT_PUBLIC_STRAPI_API_URL_GRAPHQLshould be set ashttp://localhost:1337/graphql(no trailing slash).
Make sure that the local Strapi server is still running at http://localhost:1337. Inside the Next.js app directory, run:
npm install
npm run dev
# or
yarn install
yarn devYour wild-slider application should be up and running on http://localhost:3000! You should see the 4 entries you’ve created. If it doesn't work, make sure that:
- You’ve set the Roles & Permissions in Step 4.
- You’ve clicked on "Publish" in Step 3