-1

This is the scenario :

In a university, there are many departments and one department has many programs ( One to Many ) and I want to fetch 'All the Programs that belong to a particular Department'

How to best define restful endpoints for such cases in expressJs(node)??

Also how to determine endpoints for many to many and one to one relationship?

Thank You !!

1 Answers1

0

Express will handle responses and requests for you. It doesn't care about the logic within, if you are doing a restful service, fetching data from a db or whatever operation you are doing.

Now if you are using a SQL DB I recommend you look into Sequelize to have an ORM and create simple endpoints for CRUD operations, there are a lot of examples out there and you can quickly find the answer to your question.

If you are using Mongo I recommend you use Mongoose and you will also find a lot of examples to create a simple CRUD restful service.

But remember express and node don't dictate what db engine and ORM (optional) you use, therefore they don't dictate how relationships are handled.

Danny Sandi
  • 657
  • 7
  • 27