A realtime chat app using node.js mvc
Client: Ejs, TailwindCSS
Server: Node, Express
Database: MongoDB
Clone the repo and install the dependencies.
git clone https://github.com/contentful/the-example-app.nodejs.git
cd the-example-app.nodejs
npm install
To start the express server, run the following
npm run start:dev
Open http://localhost:3000 and take a look around.
Step 1: Install the Contentful CLI
Step 2: Login to Contentful through the CLI. It will help you to create a free account if you don't have one already.
contentful login
Step 3: Create a new space
contentful space create --name 'My space for the example app'
Step 4: Seed the new space with the example content model the-example-app
. Replace the SPACE_ID
with the id returned from the create command executed in step 3
contentful space seed -s '<SPACE_ID>' -t the-example-app
Step 5: Head to the Contentful web app's API section and grab SPACE_ID
, DELIVERY_ACCESS_TOKEN
, PREVIEW_ACCESS_TOKEN
.
Step 6: Open variables.env
and inject your credentials so it looks like this
NODE_ENV=development
CONTENTFUL_SPACE_ID=<SPACE_ID>
CONTENTFUL_DELIVERY_TOKEN=<DELIVERY_ACCESS_TOKEN>
CONTENTFUL_PREVIEW_TOKEN=<PREVIEW_ACCESS_TOKEN>
PORT=3000
Step 7: To start the express server, run the following
npm run start:dev
Final Step:
Open http://localhost:3000?editorial_features=enabled and take a look around. This URL flag adds an “Edit” button in the app on every editable piece of content which will take you back to Contentful web app where you can make changes. It also adds “Draft” and “Pending Changes” status indicators to all content if relevant.