Skip to content

magilo/mg-rewards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MG Rewards

Web service for adding and spending rewards points in user account.

About

This project was created as an exercise to practice Test-Driven Development (TDD) and to review foundational concepts of a REST API. I took the opportunity to set this project up from scratch in order to learn more about the role of Express in backend development. It was also the first time I assembled documentation using Swagger as I needed an interface to present my API.

Technologies Used

Notes:
I picked SQLite as the database for this project because I found out about in-memory databases only recently and I wanted to try using one. SQLite is prototype friendly and easy to set up. However, SQLite doesn't seem to be deployment friendly.

Features

  • Transactions can be added for points
  • Points can be spent
  • Get remaining points balance

Project Preview

MG Rewards API - Watch Video

Setup

Setup for project on local environment:

  • You will need node and npm installed globally on your machine.
  • Git fork this repository into your desired directory. [forking guide]

Install dependencies:

npm install

Start local server:

npm start
  • Open http://localhost:3000/api-docs/#/ in your browser to access api docs.
  • Nodemon will watch for any changes in the files

Run tests:

npm test
  • Jest will watch for any changes in the files

Notes:

  • Make sure your Node version is at least version 14.
  • Please note swagger-jsdoc is using v6.0.0 in this project. Other versions are not guaranteed to work.

Room for Improvement

Room for improvement:

  • missing validation and error handling inside routes

  • could have better error handling endware for routes

  • more thorough tests that handle edge cases and invalid inputs

  • better interfacing between route and resources

    e.g rename /api/transactions/{payer} ---> /api/transactions/add

To do:

  • research best practices for REST Architecture
  • research some ways to deploy projects with SQLite

Acknowledgements

Tutorials used for this project:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published