Skip to content

Instantly share code, notes, and snippets.

@chrisoverstreet
Created May 23, 2018 15:54
Show Gist options
  • Save chrisoverstreet/f999f874bc1a6b868cf6e06711a8a736 to your computer and use it in GitHub Desktop.
Save chrisoverstreet/f999f874bc1a6b868cf6e06711a8a736 to your computer and use it in GitHub Desktop.
Cosmic Blog tutorial - API endpoint for site metadata
// 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