Skip to content

Wahuh/topical-news-api

Repository files navigation

Topical News Api

A server built with Express and PostgresSQL for a Reddit style app. It serves JSON responses to a React frontend.

This server is hosted at: https://speedwagon-server.herokuapp.com/ Try out the app at: https://topical-news.netlify.com/ Frontend repo at: https://github.com/Wahuh/topical-news

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Git installed
  • Node.js installed
  • PostgresSQL installed

Installing

git clone https://github.com/Wahuh/topical-news-api.git

Install dependencies

cd topical-news-api
npm install

Create a knexfile.js in the root of your local respository that looks like this:

const { DB_URL } = process.env;
const ENV = process.env.NODE_ENV || "development";

const baseConfig = {
  client: "pg",
  migrations: {
    directory: "./db/migrations"
  },
  seeds: {
    directory: "./db/seeds"
  }
};

const customConfig = {
  development: {
    connection: {
      database: "nc_news",
      username: "your_psql_username",
      password: "your_psql_password"
    }
  },
  test: {
    connection: {
      database: "nc_news_test",
      username: "your_psql_username",
      password: "your_psql_password"
    }
  },
  production: {
    connection: `${DB_URL}?ssl=true`
  }
};

module.exports = { ...customConfig[ENV], ...baseConfig };

Create your test and dev databases

npm run setup-dbs

Start the dev server

npm run dev

Running the tests

npm t

Built With

  • Express
  • PostgresSQL

Authors

  • Thanh Doan

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published