This RESTful API has been built to access application data programmatically using CRUD operations.
The intention is to mimic the construction of a real-world backend news service (such as Reddit), which should provide information to frontend architecture.
It allows a client to post, get, patch and delete articles, topics, users and comments. It also accepts complex database queries using parametric endpoints, manipulating data to sort, order, limit and paginate the response.
It has been designed with the Model View Controller (MVC) pattern and developed using Test-Driven Development (TDD).
A hosted version of this project is available online here.
The frontend component of this project can be viewed here
Please be patient when clicking the links above, as they can take a minute or two to spin up for the first time!
Please note: Your browser may require an extension to format the JSON file to be a little easier to read. For Chrome users, this one comes highly recommended!
These instructions will get a copy of this project running on your local machine for development and testing purposes!
We need to create a clone of the repository, install some dependencies and set up our testing and development databases.
This API uses Node.js and PostgreSQL for database interactions, so please ensure your installation meets the following minimum requirements:
- Node v22.8.0
- PostgreSQL v16.4
Open your terminal, navigate to the directory where you'd like to copy this repo, and run the following command:
git clone https://github.com/smlbrd/wren-nc-news.git
To run this API, we'll need to install some dependencies using the following terminal command:
npm install
To set up test and development databases and run this API, create these 2 files in the root of your directory:
-
.env.test
- This file should contain:
PGDATABASE=nc_news_test
- This file should contain:
-
.env.development
- This file should contain:
PGDATABASE=nc_news
- This file should contain:
Now we're ready to seed our databases!
Now we have our databases set up, we can seed them with the following command:
npm run setup-dbs
The test suite for this project can be run with the following command:
npm test app
If you'd like to expand on this project and add your own tests, all the dependencies used for this project are listed below.
That's it - you're good to go! Have fun, and thank so much for taking a look at my work! 🙌
This project gratefully depends on the work of:
This portfolio project was built by Wren Hawthorne as part of a Digital Skills Bootcamp in Software Engineering provided by Northcoders