How to write a GET request which checks related tables?

I have a table called companies which is related to another table called company_overviews . The name of a company is stored in the company_overviews table. How do I write a get request which returns the company which matches the name from company_overviews?

To get all companies I do:


and I get back an array as such:

    "id": 2,
    "website": "",
    "domain": "aero",
    "overviews": [
            "id": 2,
            "company_id": 2,
            "name": "aeroo",

I have tried


But i keep getting a 400 bad request


It depends how you write your server endpoints.
Most of the time you need to query twice with Rest API.

fetch(companies table)
.then(res => res.json())
.then(data => fetch(companies overview table))
// rest of code here...

I might be wrong since I didn’t have any clue how you design your API and database.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.