GroupThreeFS / FullStack_GroupThree

The Final Sprint Project showcasing our knowledge of interacting node js with mongo db and postgres sql to create a search function similar to google.
Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

Working POSTGRES api routes #22

Closed JonnyNL closed 1 year ago

JonnyNL commented 1 year ago

A working version with postgres api routes.

Added searchController : This handles the functioning, depicts what the requested method is, then depicts the selected database. Place holder for mongo and intertwined db connection.

Added apiDAL.js for mongo and postgres: postgres was tested, I dont have mongo set up on my pc (Mongo connections are commented out due to testing purposes.)

I wont be attaching the issue as mongo must still be tested, and logs about user routing need to be added

New routes that work:

To fetch all games: http://localhost:3000/api/Games?db=postgres

To fetch a specific game by its ID (replace 1 with the desired game ID): http://localhost:3000/api/Games/1?db=postgres

To fetch the developer of a specific game (replace 1 with the desired game ID):| http://localhost:3000/api/Games/1/Developer?db=postgres

To fetch the console of a specific game (replace 1 with the desired game ID): http://localhost:3000/api/Games/1/Console?db=postgres

To fetch all developers: http://localhost:3000/api/Developers?db=postgres

To fetch a specific developer by its ID (replace 1 with the desired developer ID): http://localhost:3000/api/Developers/1?db=postgres

To fetch all consoles: http://localhost:3000/api/Consoles?db=postgres

To fetch a specific console by its ID (replace 1 with the desired console ID): http://localhost:3000/api/Consoles/1?db=postgres

All routes are affixed to the /api route in index.js. Routes themselves can be found in apiRoutes.js in routes folder