Created
July 27, 2020 18:12
-
-
Save tonyspiro/36d4a91f4e835f1817dea0509513e519 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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