This API mimics a real world backend service like Reddit. The database is PSQL and it is interacted with using node-postgres.
The API is hosted on Render and the DB with ElephantSQL.
You will need:
See the live API 🚀🚀🚀
-
Clone the repo from GitHub
-
Create a new public GitHub repo. Do not initialise with readme, .gitignore, or license!
-
From your cloned local version of the project, push your code to your new repo using...
git remote set-url origin YOUR_NEW_REPO_URL_HERE
git branch -M main
git push -u origin main
There are two databases - one for real-looking dev data and one for simpler test data.
- Create two .env files
.env.test
.env.development
-
Add
PGDATABASE=\<database_name>
to each .env file. See /db/setup.sql for the correct names. -
.gitignore
the two .env files.
npm install
npm run setup-dbs
npm run seed
npm run test
GET /api/topics
- responds with a list of topics
GET /api
- responds with a list of available endpoints
GET /api/articles/:article_id
- responds with a single article by article_id
GET /api/articles
- responds with a list of articles
GET /api/articles/:article_id/comments
- responds with a list of comments by article_id
POST /api/articles/:article_id/comments
- add a comment by article_id
PATCH /api/articles/:article_id
- updates an article by article_id
DELETE /api/comments/:comment_id
- deletes a comment by comment_id
GET /api/users
- responds with a list of users
GET /api/articles (queries)
- allows articles to be filtered and sorted
GET /api/articles/:article_id (comment count)
- adds a comment count to the response when retrieving a single article