Last active
December 9, 2020 22:35
-
-
Save K-Mistele/aba44082c94f10c42f84443be2dd4c98 to your computer and use it in GitHub Desktop.
CodeLighthouse's Express.js Integration
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
// NOTE: make sure you've imported and configured codelighthouse first! | |
const app = express(); | |
// NOTE: this must be the first piece of middleware in the app | |
app.use(codelighthouse.integrations.express.requestHandler); | |
// your routes and middleware go here | |
app.route("/", (request, response, next) => { | |
// CODE HERE | |
}); | |
// NOTE: THIS NEEDS TO GO AFTER YOUR ROUTES, AND BEFORE OTHER ERROR HANDLERS | |
app.use(codelighthouse.integrations.express.errorHandler); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment