Agora ; Derived from the ancient greek marketplace in athens, meaning an "assembly of the people" or "to gather"
Find the hosted version here
This is my first ever back-end project , completed during my time on the Northcoders Bootcamp. The project is an API for a news/social platform (a Reddit clone) designed to serve data to a front-end application. Various HTTP methods are supported, allowing multiple functionalities.
such as retrieving all articles, topics, comments and users. Articles can be retieved by ID and all comments can be recieved for a specific article. New comments can be posted or existing comments deleted for a specific article and an articles vote count can be updated.
I built this project using the concepts of Test-Driven Development with Integration Testing and I adpoted an MVC design for the project structure.
I have hosted the Database on Supabase and the API on Render.
- Retrieve all articles, topics, comments and users
- Retrieve a specific article by ID
- Retrieve all comments for a specific article
- Post comments to a specific article, or delete existing ones
- Update a specific articles vote count
- Etc.
- JavaScript
- PostgreSQL
- express.js
- node.js
- jest & jest-sorted
- supertest
- pg & pg-format
- dotenv
A link to the hosted version can be found above, however if you would like to run the project locally please follow the following steps;
- Node.js: v21.x or higher
- PostgreSQL: v14.x or higher
git clone https://github.com/charley-js/be-project
cd be-project
npm install
Please check the package.json to ensure all dependencies have been installed
- You can download PostgreSQL from here
psql
CREATE USER your_username WITH PASSWORD 'your_password'
-
The .env files for this project have been .gitignored for the purposes of concealing the database names and protecting against SQL injection
-
If cloning this project locally, the following files must be added inside the db directory.
1 .env.development
PGDATABASE = development-db-name
2 .env.test
PGDATABASE = test-db-name
- These files can then be referenced in the connection.js file, allowing the connection of node.js to the relevant db.
- Run the following in the bash terminal of the project in VScode
npm run setup-dbs
npm run seed
npm start
- The server will start at http://localhost:9090
- You can send request to the API endpoints using software such as postman or insomnia
- To recieve a list of all possible endpoints, send the following GET request
- http://localhost:9090/api
To run and view the tests pass, and seed the test database with test data, run the following
npm test app