Skip to content

Commit

Permalink
Refactor cars fuel type params for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed Jun 16, 2024
1 parent 7f75a0f commit 5b32749
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ app.get("/", async (c) => {
return c.json(await getCarsByFuelType(FUEL_TYPE.PETROL, month));
});

app.get("/cars/:type", async (c) => {
const type = c.req.param("type");
app.get("/cars/:fuelType", async (c) => {
const fuelType = c.req.param("fuelType");
const month = c.req.query("month");
return c.json(await getCarsByFuelType(type, month));
return c.json(await getCarsByFuelType(fuelType, month));
});

app.get("/make", async (c) => {
return c.json(await db.collection<Car>("cars").distinct("make"));
});
Expand Down

0 comments on commit 5b32749

Please sign in to comment.