This is a demo app for the Content Previews course on our Learning Center.
- Node.js
- Contentful API keys
Create an empty space in Contentful and note the API keys (delivery, preview and management). From the Contentful web app go to SPACE SETTINGS --> API keys....
After downloading this repo, open the project's location on your computer and run "npm install" from your terminal window to install the dependencies.
After installing the dependencies run the "npm run setup" command to configure the app. type in the keys at the prompt.
Run the app with "npm run dev".
Open the link http://localhost:9009/ on your browser.
Setup preview on the Contentful web app, your preview URL should be a combination of your app's URL and your preview secret (from step 3) for example: http://localhost:9009/api/preview?secret=testing&slug={entry.fields.slug}
Go to the Contentful Web app --> SPACE SETTINGS --> Content preview.
Setup preview for the Post content model and use a url like the below;
http://localhost:9009/api/preview?secret=your-preview-secret&slug={entry.fields.slug}