Skip to main content
Tweeted twitter.com/StackSoftEng/status/852946036393955328
added 92 characters in body
Source Link

I'm developing both a REST API and a frontend web app. What's the best way to go about plugging the API into the web app while I'm developing locally on my machine?

  1. I could spin up a local copy of the API and point my web app to localhost:api-port, but that seems like unnecessary administrative work to have a local copy of both the API and web app running. Every time I want to do any development work I'll have to spin up the API, then spin up the web app.

  2. I could set up a remote dev environment and point my web app to dev.api.mydomain.com for local development, but it seems counter intuitive to have to set up a remote API sandbox to develop the web app locally.

  3. I could mock schemas and data with JSON files for local development. Instead of the web app doing a GET to api.mydomain.com it'll just read ./mock-data/some-resource.json. Seems like extra overhead to keep schemas and data matching production. Also wouldn't handle any logic that's built into the API on top of returning raw resources.

Best way forward?

I'm developing both a REST API and a frontend web app. What's the best way to go about plugging the API into the web app while I'm developing locally on my machine?

  1. I could spin up a local copy of the API and point my web app to localhost:api-port, but that seems like unnecessary administrative work to have a local copy of both the API and web app running. Every time I want to do any development work I'll have to spin up the API, then spin up the web app.

  2. I could set up a remote dev environment and point my web app to dev.api.mydomain.com for local development, but it seems counter intuitive to have to set up a remote API sandbox to develop the web app locally.

  3. I could mock schemas and data with JSON files for local development. Instead of the web app doing a GET to api.mydomain.com it'll just read ./mock-data/some-resource.json. Seems like extra overhead to keep schemas and data matching production.

Best way forward?

I'm developing both a REST API and a frontend web app. What's the best way to go about plugging the API into the web app while I'm developing locally on my machine?

  1. I could spin up a local copy of the API and point my web app to localhost:api-port, but that seems like unnecessary administrative work to have a local copy of both the API and web app running. Every time I want to do any development work I'll have to spin up the API, then spin up the web app.

  2. I could set up a remote dev environment and point my web app to dev.api.mydomain.com for local development, but it seems counter intuitive to have to set up a remote API sandbox to develop the web app locally.

  3. I could mock schemas and data with JSON files for local development. Instead of the web app doing a GET to api.mydomain.com it'll just read ./mock-data/some-resource.json. Seems like extra overhead to keep schemas and data matching production. Also wouldn't handle any logic that's built into the API on top of returning raw resources.

Best way forward?

Source Link

Remote vs local API for local web app development

I'm developing both a REST API and a frontend web app. What's the best way to go about plugging the API into the web app while I'm developing locally on my machine?

  1. I could spin up a local copy of the API and point my web app to localhost:api-port, but that seems like unnecessary administrative work to have a local copy of both the API and web app running. Every time I want to do any development work I'll have to spin up the API, then spin up the web app.

  2. I could set up a remote dev environment and point my web app to dev.api.mydomain.com for local development, but it seems counter intuitive to have to set up a remote API sandbox to develop the web app locally.

  3. I could mock schemas and data with JSON files for local development. Instead of the web app doing a GET to api.mydomain.com it'll just read ./mock-data/some-resource.json. Seems like extra overhead to keep schemas and data matching production.

Best way forward?