Skip to content

Instantly share code, notes, and snippets.

@tonyspiro

tonyspiro/home.js

Created Jul 27, 2020
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
You can’t perform that action at this time.