Skip to content

Instantly share code, notes, and snippets.

@K-Mistele
Last active December 9, 2020 22:35
Show Gist options
  • Save K-Mistele/aba44082c94f10c42f84443be2dd4c98 to your computer and use it in GitHub Desktop.
Save K-Mistele/aba44082c94f10c42f84443be2dd4c98 to your computer and use it in GitHub Desktop.
CodeLighthouse's Express.js Integration
// 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