Coder Social home page Coder Social logo

product-catalogue-js's Introduction

JavaScript Product Catalogue

Contentful provides a content infrastructure for digital teams to power content in websites, apps, and devices. Unlike a CMS, Contentful was built to integrate with the modern software stack. It offers a central hub for structured content, powerful management and delivery APIs, and a customizable web app that enable developers and content creators to ship digital products faster.

This repository shows how to build a frontend JavaScript based application with Contentful for a Product Catalogue, based on the Contentful starter Product Catalogue example space.

This project uses no specific frameworks and is written in plain JavaScript, making use of browser APIs and HTML/CSS.

The application is split over multiple files which are included via script tags in the index.html file. While this approach is taken here for simplicity, this is not advised for production deployments. Make sure you always bundle up and minify your JavaScript code.

The only external dependencies are:

Who is this for?

This application was developed in order to show a very simple way of developing a frontend JavaScript application with Contentful, without the aid of any more complex frameworks or tools.

It's also focused on users who are newer to web development in general. The code is commented and explained, so even if you are not so experienced with webdevelopment you can get an understanding of what's happening in the code.

If you'd like to see more complex examples you can look at the React discovery app and more will come in the future.

This code makes some use of Promises, which are also used by the Contentful SDK. If you are new to promises, read this introduction and this article to learn some more common usage patterns.

Trying it out

You can try this app at http://contentful.github.io/product-catalogue-js

Try it on JSFiddle

You can try and play with a subsection of this app at the following fiddle: https://jsfiddle.net/trodrigues/btvhh4ma/

There you can see how to get and display a list of products.

Running it locally

Because this app makes use of the browser's History API you can't just open the index.html file locally on a browser.

You'll need an http server in order to run this.

If you have node.js and npm available, you can run npm install http-server and then run http-server. Now you can open http://localhost:8080 in your browser.

If you are on Mac OSX you can also run python server.py in the project directory. Now open http://localhost:8000 in your browser.

If you use any other server and serve this in a subdirectory, make sure to set the appropriate value in the <base> tag on index.html

For instance, for http://contentful.github.io/product-catalogue-js the tag would look as <base href='/product-catalogue-js/' />

product-catalogue-js's People

Contributors

trodrigues avatar khaledgarbaya avatar lynnagara avatar christineywang avatar npmcdn-to-unpkg-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.