Skip to content

Commit

Permalink
fix(gatsby-plugin-netlify-cms): Add listener for /admin (#12474)
Browse files Browse the repository at this point in the history
* Add listener for /admin

* Update packages/gatsby-plugin-netlify-cms/src/gatsby-node.js

Co-Authored-By: sidharthachatterjee <me@sidharthachatterjee.com>
  • Loading branch information
sidharthachatterjee committed Mar 11, 2019
1 parent fceb4e7 commit 617df24
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/gatsby-plugin-netlify-cms/src/gatsby-node.js
Expand Up @@ -32,6 +32,20 @@ function deepMap(obj, fn) {
return obj
}

exports.onCreateDevServer = ({ app, store }) => {
const { program } = store.getState()
app.get(`/admin`, function(req, res) {
res.sendFile(
path.join(program.directory, `public/admin/index.html`),
err => {
if (err) {
res.status(500).end(err.message)
}
}
)
})
}

exports.onCreateWebpackConfig = (
{ store, stage, getConfig, plugins, pathPrefix },
{
Expand Down

0 comments on commit 617df24

Please sign in to comment.