diff --git a/backend/src/app.ts b/backend/src/app.ts index 1b2b0506..f6c8a8a9 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -88,9 +88,9 @@ app.use( * API routes. */ app.post("/api/login", apiController.login); -app.post("/api/listings/new", apiController.newListing); -app.get("/api/listings/nearby", apiController.getNearby); -app.post("/api/users/new", apiController.newUser); +app.post("/api/new-listing", apiController.newListing); +app.get("/api/discover", apiController.getNearby); +app.post("/api/register", apiController.newUser); app.get("/api/users/:id/listings", apiController.getListingsByHostId); app.get("/api/users/:id/rentals", apiController.getRentalHistory); app.get("/api/users/:id/lendings", apiController.getLendingHistory); diff --git a/backend/src/controllers/api.ts b/backend/src/controllers/api.ts index 558be180..9015991c 100644 --- a/backend/src/controllers/api.ts +++ b/backend/src/controllers/api.ts @@ -80,7 +80,7 @@ export const login = async (req: Request, res: Response) => { }; /** - * POST /api/users/new + * POST /api/register * @param {string} req.body.email * @param {string} req.body.password * @param {string} req.body.phone @@ -127,7 +127,7 @@ export const getLendingHistory = async (req: Request, res: Response) => { }; /** - * POST /api/listings/new + * POST /api/new-listing * @param {string} req.body.hostId * @param {number} req.body.lat * @param {number} req.body.lon @@ -181,7 +181,7 @@ export const rentListing = async (req: Request, res: Response) => { }; /** - * GET /api/listings/nearby + * GET /api/discover * @param {number} req.query.lat Latitude of where the user is * @param {number} req.query.lon Longitude of where the user is * @param {number} req.query.minCapacity Minimum capacity of a listing to show up in the results diff --git a/frontend/src/pages/Discover.tsx b/frontend/src/pages/Discover.tsx index 6dc187be..7bbd8259 100644 --- a/frontend/src/pages/Discover.tsx +++ b/frontend/src/pages/Discover.tsx @@ -19,7 +19,7 @@ function fetcher(url: string) { } const Discover: React.FC = () => { - const { data, error } = useSWR('https://storestash.herokuapp.com/api/listings/nearby', fetcher); + const { data, error } = useSWR('https://storestash.herokuapp.com/api/discover', fetcher); let content; if (error) content =
failed to load
diff --git a/frontend/src/pages/Register.tsx b/frontend/src/pages/Register.tsx index ade90c05..528a5857 100644 --- a/frontend/src/pages/Register.tsx +++ b/frontend/src/pages/Register.tsx @@ -41,7 +41,7 @@ const Register: React.FC = (props) => { // TODO: get authorization token if (!validationErr) { try { - await wretch('https://storestash.herokuapp.com/api/users/new') + await wretch('https://storestash.herokuapp.com/api/register') .post({ email, password: password1,