answering-forum-backend
A Node.js Express backend for a Stackoverflow like answering forum, with RESTful endpoints, written in es6 style with linted and comprehensively unit-tested code. Utilizes a local json database using fs but has full separation of concern to implement anything else.
Created as a part of week 0 of Swiggy i++ learning programme, round 2.
Contents
Setup
-
Install NodeJS and any NodeJS package manager.
-
Run
npm install
oryarn install
to install the dependencies. -
Run
npm run build
oryarn build
once to let babel build the application on ./lib/.
Usage
Run npm run start
or yarn start
after building to run the application on localhost:4000 (default).
Project Structure
The project's code structure loosely follows MVC model while maintaing complete seperation of concern.
- answering-forum-backend
- src
- controllers
- login_post.js
- answers
- answer_post.js
- questions
- question_get.js
- question_post.js
- register_post.js
- database
- answers.json
- questions.json
- users.json
- models
- answer_data.js
- question_data.js
- user_data.js
- repositories
- answers.js
- questions.js
- users.js
- routes
- login.js
- question
- questionID
- answer.js
- index.js
- index.js
- questionID
- register.js
- utils
- validators.js
- index.js
- controllers
- tests
- controllers
- answer
- answer_post.test.js
- question
- question_get.test.js
- question_post.test.js
- login_post.test.js
- register_post.test.js
- answer
- database
- answers.test.json
- questions.test.json
- users.test.json
- repositories
- answers.test.js
- questions.test.js
- users.test.js
- controllers
- .eslintrc.yml
- babel.config.json
- package.json
- package-lock.json
- src
License
This project is licensed under the MIT License. See the LICENSE for details.
Contributing
Feel free to contribute pull requests, issues for either APIs or tests. See the CONTRIBUTING.md for details.
Tests
Run npm test
or yarn test
to run the unit tests. Feel free to add your own tests for better test coverage while contributing.