Skip to content

ismaelpaul/be-nc-news

Repository files navigation

Backend Project: News API

Summary

This project I made as part of the Backend module at Northcoders. It aimed to build an API for the purpose of accessing application data programmatically. The intention here is to mimic the building of a real world backend service (such as reddit) which should provide this information to the front end architecture.

-> Hosted Version

Getting started

1. Clone this repository

https://github.com/ismaelpaul/be-nc-news.git
cd be-nc-news

2. Install packages and dependencies

npm install
npm install -D jest
npm install -D jest-sorted
npm install -D supertest

3. Seed local database

The database is PSQL, and you will interact with it using node-postgres. You can add these two scripts to package.json

"scripts":
{
    "setup-dbs": "psql -f ./db/setup.sql",
    "seed": "node ./db/seeds/run-seed.js",
  }

And then run:

npm run setup-dbs
npm run seed

4. Create .env files

You’ll have two databases in this project. One for real looking dev data and another for simpler test data.

You will need to create two .env files (in the main folder) for your project: .env.test and .env.development. Into each, add:

PGDATABASE=<database_name_here>

with the correct database name for that environment (see /db/setup.sql for the database names).

So the .env.test file should be as follow:

PGDATABASE=nc_news_test

And the .env.development file should be:

PGDATABASE=nc_news

Double check that these .env files are .gitignored.

5. Run tests

npm test

Minimum Requirements

  • Node.js version 16.17.0
  • Postgres version 14.5

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published