This guide will walk you through your first steps using Contentful within an Express Node js application. It will provide a step-by-step guide on how to get your first entries and start using the content you create on Contentful.
First we'll start with a demo project, which is a simple Express js application using Contentful's 'Product Catalogue' template, so that you can see it running for yourself.
Run the following commands to get started.
git clone https://github.com/contentful/contentful_express_tutorial.git
$ cd contentful_express_tutorial
$ npm install
$ npm run dev
Everything is now set up. You can view your new data by opening http://localhost:3000/ in your browser.
It should look something like this:
You can create your own custom data by following these steps:
Change the product content type by your own, here.
Change the category content type by your own, here.
In the Express js application:
configsection and save.
npm run devto start the server
Next in the Contentful web app > Content:
You can continue to edit your content inside the [Contentful web app] and see the content change inside your application.
To view the demo application live in your own production environment, follow these steps:
git add . git commit -m "Add Website"
git push heroku master
After this guide, you should be able to start using Contentful with your Express js applications, but every project has different needs and we want to provide you with the best solutions we can.
You can read about the Contentful CDA library in more detail on our contentful.js GitHub or our Getting Started with CDA SDK tutorial. We also suggest taking a look at our Product Example Application.
Do you like building static sites? Check how to build static sites using Contentful with Metalsmith