This is the backend of a full stack reddit-style message board written in React, completed as part of the intensive full time Developer Pathway software development course at Northcoders in Manchester between October and December 2018.
- The deployed version of the site can be found here: http://confident-gates-cb16d1.netlify.com.
- The deployed API for the backend can be found here: https://frozen-river-28585.herokuapp.com/api
- The github repo for the frontend API can be found here: https://github.com/dpocknee/nc-news_frontend
The backend consists of a RESTful API which allows access to a Mongo database hosted on mLab.
The frontend serves this data in a dynamic React application.
Users can vote on articles and comments, and logged-in users can add or delete comments or articles.
- Fork and clone down this .git repository.
- For testing and development you will need to add a config.js file into the root folder. This file should look like this:
const config = {
dev: {
DB_URL: 'mongodb://localhost:27017/dev_nc_news'
},
test: {
DB_URL: 'mongodb://localhost:27017/test_nc_news'
}
};
module.exports = config;
- Run
npm install
to install any dependencies.
- node
- mongoDB
-
First, make sure that you have mongoDB installed and that
mongod
is running. -
Seed the database with data. If you are wanting to run the API in
dev
mode, use the commandnpm run seed:dev
. -
Navigate to the folder and run
npm start
, this will start up a local server on port 9090. -
Open a browser of your choice and navigate to
localhost:9090/api
. This will give you a list of possible API endpoints, all of which you can navigate to.
All tests are run using mocha
, chai
and supertest
.
The tests check all API endpoints and automatically reseed the test database before each test is run.
All tests can be run using npm test
.
If you want to reseed the test database manually, you can use the command npm run seed:test
- node.js
- David Pocknee - dpocknee
- Northcoders