From 7a180c912a06b64840bd5d459f8f890de22b8f3e Mon Sep 17 00:00:00 2001 From: Bolaji Ayodeji Date: Mon, 17 Jun 2024 14:39:59 +0100 Subject: [PATCH] docs: update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index b752421..1f85a72 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ import axios from "axios"; const app = express(); const port = 3000; +// IMPORTANT: apitoolkitClient must be declared +// BEFORE all controllers and middleware in your application. const apitoolkitClient = APIToolkit.NewClient({ apiKey: "{ENTER_YOUR_API_KEY_HERE}" }); app.use(express.json()); @@ -53,6 +55,9 @@ app.get("/", (req, res) => { res.json({ hello: "Hello world!" }); }); +// IMPORTANT: apitoolkitClient.errorHandler must be declared +// AFTER declaring apitoolkitClient.expressMiddleware +// and all controllers and BEFORE any other error middleware. app.use(apitoolkitClient.errorHandler); app.listen(port, () => console.log("App running on port: " + port));