The new version of XCoin's test REST-API is based on Node.js and TypeScript.
- Node.js 14 or later
- NPM 6.2 or later
- MongoDB 4.3 or later
app
andserver
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
andcontroller
files were not separated - JavaScript coding
conventions
are not being followed, for example, in the naming ofvariables
- 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
, andluxon
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 thanstrings
in models - The absence of some
CRUD
operations and routes
To run this project, you will need to add the following environment variables to your .env file
PORT
BASE_URL
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
To deploy this project run
npm run deploy:prod
or in development
npm run deploy:dev
To run tests, run the following command
npm run test
There are three collections: Profiles
, Simulators
, and Favorites
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