Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
BolajiAyodeji authored Jun 17, 2024
1 parent 682dcda commit 7a180c9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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));
Expand Down

0 comments on commit 7a180c9

Please sign in to comment.