Skip to content

samanbaboli/xcoin

Repository files navigation

A production ready of Xcoins™ REST-API

The new version of XCoin's test REST-API is based on Node.js and TypeScript.

Requirements

  • Node.js 14 or later
  • NPM 6.2 or later
  • MongoDB 4.3 or later

🔖 Previous Version Issues

  • app and server were not separated.
  • Excessive use of var
  • Unit tests was not used
  • The endpoints did not have any validation.
  • There was no gitignore file
  • No comments
  • Responses were not in a specific format.
  • No Readme.md file
  • The router and controller files were not separated
  • JavaScript coding conventions are not being followed, for example, in the naming of variables
  • There was no rate limiter
  • Excessive use of console.log
  • The description and author name in package.json were blank
  • There are no typescript interfaces for models
  • Chart.js, express-handlebars, and luxon were not required but were included as dependencies
  • There is no error handler
  • Lodash is required but not used
  • IDs should be defined as objectIds rather than strings in models
  • The absence of some CRUD operations and routes

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

PORT BASE_URL

Run Locally

Clone the project

  git clone https://github.com/samanbaboli/xcoin.git

Go to the project directory

  cd xcoin

Install dependencies

  npm install

or using yarn

  yarn

Start the server

  npm run start

Deployment

To deploy this project run

  npm run deploy:prod

or in development

  npm run deploy:dev

Running Tests

To run tests, run the following command

  npm run test

API Reference

There are three collections: Profiles, Simulators, and Favorites

CRUD

Method Route Description
POST /api[collectionName] Create and item
GET /api[collectionName] Get all items of collection
GET /api[collectionName]/:id Get an item of collection
PUT /api[collectionName]/:id Update an item of collection
DELETE /api[collectionName]/:id Delete an item of collection

For more information on APIs, go to /api-docs and check out all documentation generated by Swagger after running the project

Authors

About

A production ready of XCoin's REST-API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published