This is an api that hosts a small database of news articles, with users and comments.
git clone https://github.com/smetca/sam-wise-news.git
npm install
npm run setup-db
npm run seed
Create a file called knexfile.js
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 = {
production: {
connection: `${DB_URL}?ssl=true`
},
development: {
connection: {
database: 'nc_news',
//username
//password
}
},
test: {
connection: {
database: 'nc_news_test',
//username
//password
}
}
};
module.exports = { ...customConfig[ENV], ...baseConfig };
npm test
Node: version 10 and up,
Postgres: version 10.10