Fix some spelling errors (#5)
This commit is contained in:
committed by
Benedikt Rötsch
parent
e773c8b32d
commit
01fd3cc9b3
2
app.js
2
app.js
@@ -29,7 +29,7 @@ app.use(bodyParser.urlencoded({ extended: false }))
|
|||||||
app.use(cookieParser())
|
app.use(cookieParser())
|
||||||
app.use(express.static(path.join(__dirname, 'public')))
|
app.use(express.static(path.join(__dirname, 'public')))
|
||||||
|
|
||||||
// Pass custo helpers to all our templates
|
// Pass custom helpers to all our templates
|
||||||
app.use(function (req, res, next) {
|
app.use(function (req, res, next) {
|
||||||
res.locals.helpers = helpers
|
res.locals.helpers = helpers
|
||||||
const qs = url.parse(req.url).query
|
const qs = url.parse(req.url).query
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const express = require('express')
|
const express = require('express')
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
|
|
||||||
/* GET home page. */
|
/* GET about page. */
|
||||||
router.get('/', function (req, res, next) {
|
router.get('/', function (req, res, next) {
|
||||||
res.render('about', { title: 'About' })
|
res.render('about', { title: 'About' })
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const express = require('express')
|
const express = require('express')
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
|
|
||||||
/* GET courses listing. */
|
/* GET categories listing. */
|
||||||
router.get('/', function (req, res, next) {
|
router.get('/', function (req, res, next) {
|
||||||
res.render('categories', { title: 'Categories' })
|
res.render('categories', { title: 'Categories' })
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ router.get('/', async function (req, res, next) {
|
|||||||
res.render('courses', { title: `All Courses (${courses.length})`, categories, courses })
|
res.render('courses', { title: `All Courses (${courses.length})`, categories, courses })
|
||||||
})
|
})
|
||||||
|
|
||||||
/* GET courses listing. */
|
/* GET courses listing by category. */
|
||||||
router.get('/categories/:category', async function (req, res, next) {
|
router.get('/categories/:category', async function (req, res, next) {
|
||||||
// we get all the entries with the content type `course`
|
// we get all the entries with the content type `course` filtered by a category
|
||||||
let courses = []
|
let courses = []
|
||||||
let categories = []
|
let categories = []
|
||||||
let activeCategory = ''
|
let activeCategory = ''
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const express = require('express')
|
const express = require('express')
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
|
|
||||||
/* GET seeting page. */
|
/* GET sitemap page. */
|
||||||
router.get('/', function (req, res, next) {
|
router.get('/', function (req, res, next) {
|
||||||
res.render('sitemap', { title: 'Sitemap' })
|
res.render('sitemap', { title: 'Sitemap' })
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -21,15 +21,15 @@ exports.initClient = (options) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exports.getCourses = (locale = 'en-US', api = `cda`) => {
|
exports.getCourses = (locale = 'en-US', api = `cda`) => {
|
||||||
// to get all the courses we simply request from Contentful all the entries
|
// to get all the courses we request all the entries
|
||||||
// with the content_type `course`
|
// with the content_type `course` from Contentful
|
||||||
const client = api === 'cda' ? cdaClient : cpaClient
|
const client = api === 'cda' ? cdaClient : cpaClient
|
||||||
return client.getEntries({content_type: 'course', locale, include: 10})
|
return client.getEntries({content_type: 'course', locale, include: 10})
|
||||||
.then((response) => response.items)
|
.then((response) => response.items)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.getLandingPage = (locale = 'en-US', api = `cda`) => {
|
exports.getLandingPage = (locale = 'en-US', api = `cda`) => {
|
||||||
// our Home page is fully configureable via contentful
|
// our Home page is fully configureable via Contentful
|
||||||
const client = api === 'cda' ? cdaClient : cpaClient
|
const client = api === 'cda' ? cdaClient : cpaClient
|
||||||
// TODO slug should be renamed to `contentful-the-example-app` or something ....
|
// TODO slug should be renamed to `contentful-the-example-app` or something ....
|
||||||
return client.getEntries({content_type: 'landingPage', locale, 'fields.slug': 'contentful-university', include: 10})
|
return client.getEntries({content_type: 'landingPage', locale, 'fields.slug': 'contentful-university', include: 10})
|
||||||
@@ -37,7 +37,7 @@ exports.getLandingPage = (locale = 'en-US', api = `cda`) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exports.getCourse = (slug, locale = 'en-US', api = `cda`) => {
|
exports.getCourse = (slug, locale = 'en-US', api = `cda`) => {
|
||||||
// the SDK support link resolution only when you request the collection endpoint
|
// the SDK supports link resolution only when you call the collection endpoints
|
||||||
// That's why we are using getEntries with a query instead of getEntry(entryId)
|
// That's why we are using getEntries with a query instead of getEntry(entryId)
|
||||||
// make sure to specify the content_type whenever you want to perform a query
|
// make sure to specify the content_type whenever you want to perform a query
|
||||||
const client = api === 'cda' ? cdaClient : cpaClient
|
const client = api === 'cda' ? cdaClient : cpaClient
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ extends layout
|
|||||||
block content
|
block content
|
||||||
.layout-centered
|
.layout-centered
|
||||||
h1= title
|
h1= title
|
||||||
p To query and get content using the APIs, client apllications need to authenticate iwth both the Space ID and an access token.
|
p To query and get content using the APIs, client applications need to authenticate with both the Space ID and an access token.
|
||||||
|
|
||||||
form(action=`/settings` method="POST" class="form")
|
form(action=`/settings` method="POST" class="form")
|
||||||
.form-item
|
.form-item
|
||||||
@@ -12,12 +12,12 @@ block content
|
|||||||
.help-text Some help text we still need to define
|
.help-text Some help text we still need to define
|
||||||
|
|
||||||
.form-item
|
.form-item
|
||||||
label(for="cda") Delivery API Key
|
label(for="cda") Delivery API key
|
||||||
input(type="text" name="cda" value=settings.cda)
|
input(type="text" name="cda" value=settings.cda)
|
||||||
.help-text Some help text we still need to define
|
.help-text Some help text we still need to define
|
||||||
|
|
||||||
.form-item
|
.form-item
|
||||||
label(for="cpa") Preview API Key
|
label(for="cpa") Preview API key
|
||||||
input(type="text" name="cpa" value=settings.cpa)
|
input(type="text" name="cpa" value=settings.cpa)
|
||||||
.help-text Some help text we still need to define
|
.help-text Some help text we still need to define
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user