ufosc / OSC-Proximity-Chat-App

Talk to the people closest to you. An open source React Native app that combines location and communication into one.
https://osc-proximity-documentation.vercel.app/
GNU General Public License v3.0
43 stars 100 forks source link

Refactored API Routes into Separate Files #263

Closed Kavipatel0 closed 3 weeks ago

Kavipatel0 commented 3 weeks ago

Description

Moved API Routes from index.ts into a routes folder. Routes folder includes user and auth folders with respective route handlers. Routes are contained within the user and auth folders which each have their own respective route collector in auth/index.ts and user/index.ts. This funnels into a central route handler in routes/index.ts which is then app.use() in the original server src/index.ts.

Closes #240

h1divp commented 3 weeks ago

I would rename the index.ts files into routehandler.ts or something a bit more clear in order to avoid confusion with /server's entry point. Besides that, as long as this is tested, I think this is a great change. Perhaps something could be done with the socket endpoints as well.

Kavipatel0 commented 3 weeks ago

👍🏽 I implemented the suggested changes. Instead of having index.ts files managing the route handlers, I renamed them to be more descriptive. Now, userRouteHandler.ts handles the userRouter and authRouteHandler.ts manages the authRouter. Both of these are in mainRouteHandler.ts to improve clarity and structure. 😄

h1divp commented 3 weeks ago

Thank you both !!