Last active
December 15, 2021 12:06
-
-
Save cloakedninjas/43883563dd555f33d7940415a3a69395 to your computer and use it in GitHub Desktop.
Define top-level route in Strapi v4
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
// src/plugins/healthcheck/server/bootstrap.js | |
/** | |
With a plugin called healthcheck, this exposes a URL of /status without any /api or /admin prefix | |
**/ | |
module.exports = ({ strapi }) => { | |
const routes = [ | |
{ | |
method: 'GET', | |
path: `/status`, | |
handler: 'healthcheck.index' | |
} | |
]; | |
routes.forEach(route => { | |
route.info = { pluginName: 'healthcheck' }; | |
route.config = { | |
auth: false | |
}; | |
}); | |
strapi.server.routes({ | |
type: 'admin', | |
routes: routes | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment