How to fetch all data in db and make api url

How to fetch all data in db and make api url and retun as json data.

I am trying to do is I have 5 thousands data in my db and I want to make one api url.

Backend I use java and frontend use reactjs and database sql developer

How can we do that.

Any idea and suggestion on that bcz of new in this.

Anybody helpmeout. It's very thankful