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
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Git installed
- Node.js installed
- PostgresSQL installed
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
npm t
- Express
- PostgresSQL
- Thanh Doan
This project is licensed under the MIT License - see the LICENSE.md file for details