Skip to content

maxi297/minutradeTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Minutrade Client API

Setting the environment

Install MongoDB

Install Node JS

sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm

Install Node libraries

In command line:

npm install

Run the server

Start mongo:

In command line:

  • Windows:
C:\Program Files\MongoDB\bin\mongod.exe

Mac:

mongod

Ubuntu:

sudo service mongod start

Start Node server:

In command line:

node index.js

Run the tests

Install Mocha

In command line:

npm install mocha -g

Execute

mocha test/utils/ClientValidator.js

API guide

Why MongoDB and NodeJS ?

It was hard for me to see the scope outside of this test. More information about the context and the future use of this API could have narrowed my choice between RDBMS or NoSQL and my choice for a REST API framework. Since I didn't have this information, I decided to have fun with this test and to learn something new. I choose MongoDB and NodeJS because I never use those before and I've heard a lot about it. For a small project like that, I would probably have used Spring MVC for the REST API because I am used to it (which is not a very good reason in a professional context) and I would have implemented my data layer using JSON in text files because for something that small, it removes some dependencies and it is easier to implement. I really enjoyed using MongoDB and I think for anything that is CRUD and will scale horizontaly, it is an interesting option.

Basic API documentation

Use something like Advanced REST client to do the following calls:

Get all clients

GET localhost:3000/clients

Get a client by CPF

GET localhost:3000/clients/:cpf

Create a new client

POST localhost:3000/clients

Example of body:

{"cpf":"11438374798","name":"test","email":"godo1@godo.com","maritalStatus":"single","address":"123 rue des Saules","phoneNumbers": ["11231234567", "11231234560"]}

IMPORTANT: I wasn't sure of all the validation to be done on each field so I did my best and I made it easy to change: just go to utils/ClientValidator.js and modify the private method validating the corresponding field.

Remove a client

DELETE localhost:3000/clients/:cpf

About

Minutrade Backend Developer Test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published