Created
May 23, 2018 15:54
-
-
Save chrisoverstreet/f999f874bc1a6b868cf6e06711a8a736 to your computer and use it in GitHub Desktop.
Cosmic Blog tutorial - API endpoint for site metadata
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
// API endpoint for site metadata (i.e. title, tag, logo) | |
server.get('/api/meta', (req, res) => bucket.getObject({ slug: 'header' }) | |
.then(object => res.send(object)) | |
.catch(err => res.status(404).json({ | |
message: 'Error fetching header data', | |
error: err, | |
}))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment