Skip to content

Instantly share code, notes, and snippets.

@tonyspiro
Created July 27, 2020 18:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
// home.js
import Cosmic from 'cosmicjs'
module.exports = (app, config, partials) => {
app.get('/', (req, res) => {
Cosmic.getObjects({ bucket: { slug: config.COSMIC_BUCKET } }, (err, response) => {
res.locals.cosmic = response
if (req.query.message === 'unauthorized')
res.locals.unauthorized_message = true
return res.render('index.html', {
partials
})
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment