Skip to content

Commit

Permalink
Change routes
Browse files Browse the repository at this point in the history
Heroku is being bad about what URLs are higher priority
  • Loading branch information
ML-Chen committed Apr 29, 2020
1 parent 504ac00 commit d900866
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions backend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions backend/src/controllers/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Discover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function fetcher(url: string) {
}

const Discover: React.FC<RouteComponentProps> = () => {
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 = <div>failed to load</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Register: React.FC<RouteComponentProps> = (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,
Expand Down

0 comments on commit d900866

Please sign in to comment.