podverse-api icon indicating copy to clipboard operation
podverse-api copied to clipboard

Query for podcastIds by POST body instead of GET query params

Open mitchdowney opened this issue 4 years ago • 2 comments

If the user is subscribed to hundreds of podcasts, then the GET request URL will be longer than the maximum allowed URL length.

mitchdowney avatar Jun 06 '21 01:06 mitchdowney

I would like to work on the issue

jogeshgupta963 avatar Oct 02 '22 04:10 jogeshgupta963

Hello! Our repo is not in an optimal state for onboarding new contributors...we're actually working on updating our documentation now.

I'll try to explain it though. If you are up for the challenge, there are a few things you'll need to start development locally...

NOTE: If you are comfortable enough with koa, and our routes/podcast file makes sense to you, you could even try coding this endpoint without setting up the database or running the API at all, and I can test it when you make a PR.


  1. Create the Postgres database. We have a Docker Compose process for this. Clone the podverse-ops repo. You will need to create a file named podverse-db-local.env. You can copy the example file found here. Then, run the following command from within the root of the podverse-ops repo:

docker-compose -f docker-compose.local.yml up -d podverse_db

I typically use a default local (insecure) database password of mysecretpw.

  1. Import sample data into the local Postgres database. I use the following command from within the root of the podverse-ops repo:

psql -h 0.0.0.0 -p 5432 -U postgres -W -f ./sample-database/qa-database.sql

If all goes well, you should have a database with sample data in it running locally. I recommend confirming it works with a Database GUI tool.

  1. If the database is running, you can then proceed with setting up podverse-api.

From within podverse-api, run npm install

And you will need to create a file named .env within the root of podverse-api. You can copy the .example.env file and I think it should work with the local database by default. (Some parts of the api will not work without more env variables, but for purposes of this ticket, you may not need those other env variables)

Then run npm run dev.

If all goes well, the api should start listening and be connected to your local database.

  1. This is optional, but there is a Postman collection here. The v4 version is the latest one (although it is quite old).

  2. As for the work needed...basically you will need to copy the endpoint that already exists here: https://github.com/podverse/podverse-api/blob/develop/src/routes/podcast.ts#L46

Except convert it into a .post (note, we use koa as our router...which is similar to express).

You'll need to grab the values expected by this endpoint off the post body, instead of off the get query params.


I'll leave the instructions at that. If you have any questions please let me know. If you can't get to working on this no worries, and thanks for reaching out!

mitchdowney avatar Oct 05 '22 23:10 mitchdowney