Backend for Security Plus app
you need to have the following packages installed
Node and yarn
for install consult:
git clone [email protected]:CleytonRR/security-.git
After:
cd security-/
then, install all dependencies
yarn install
when finished, create the .env file in the root folder, follow the instructions for creating
For run the automated tests and sync database use:
yarn test
for run API use:
yarn start
We have this routes [POST] -> /user [POST] -> /login [POST] -> /newCall
[GET] -> /calls
[PUT] -> /changecall
example build with Insomnia
/user
router use is a router which make create a new users
accepts email, password , CPF, age and master in json format
usage example:
password - should have length minimal 8 a character have a character caps lock, number and character special
/login
in this route should receive an email and password valid and return a token for authenticate and return master with true or false
example
**Authorization ** For authorization use token generated during login use:
/newcall
this route is protected to access it, a token that was generated during login must pass in the request header.
This router create new calls this route should receive title, description, status, latitude e longitude
example
[GET] -> /calls
This route has two possible returns, if the user is a master it returns all open calls, if the logged in user is a normal user it returns all cases created by him
example
[PUT] -> /changecall
This route close a call, this route should receive id for call
example