You can access the hosted version of this API here: https://nc-news-ysld.onrender.com/api
This link will also direct you to a full list of available endpoints and how to use them.
NC News is a RESTful API that serves news-related data, including articles, topics, users and comments. Users can interact with the API by retrieving articles, posting and deleting comments and voting on articles. This project is built using Node.js, Express and PostgreSQL.
To get started with this project locally, please follow the instructions below.
git clone https://github.com/MuseOfCode/nc-news-app.git
cd nc-news
npm installThe project requires two .env files to be created in the root directory:
PGDATABASE=nc_newsPGDATABASE=nc_news_testPlease note: .env files are ignored by Git meaning that they must be created manually.
Ensure you have PostgreSQL installed and running. Then, run the following commands to create and seed your databases:
npm run setup-dbs # This creates the databases
npm run seed-dev # This seeds the development databaseTo verify everything is set up correctly, run the test suite:
npm run testTo start the server locally, run:
npm startThe server should now be running on: http://localhost:9090.
For production deployment, a .env.production file is needed with the following format:
DATABASE_URL=your-production-database-urlAfter setting up the production database, seed it using:
npm run seed-prod- Node.js: v16+
- PostgreSQL: v12+