Files
the-example-app-nodejs/services/contentful.js
2017-11-07 17:33:32 +01:00

23 lines
516 B
JavaScript

const { createClient } = require('contentful')
const client = createClient({space: process.env.CF_SPACE, accessToken: process.env.CF_ACCESS_TOKEN})
export function getCourses () {
// to get all the courses we simply request from Contentful all the entries
// with the content_type `course`
return client.getEntries({content_type: 'course'})
}
export function getLessons (courseId) {
// TODO
}
export function getCategories () {
// TODO
}
export function getCoursesByCategory (category) {
// TODO
}