Realtime Challenge
Documentation and specific setup instructions can be found here. Those are very important to follow before trying to run the project. The following are instructions for running the full project after everything is properly setup.
- Node 8.11.1 / Npm 5.6.0
- Serverless 1.37.1
- Angular CLI: 7.3.3 (optional if you don't need to create extra elements)
- Run
rethinkdb
to start RethinkDB server - Run
deepstream start
to start Deepstream server - Go to
server
folder and doserverless offline start
- Go to
client
and donpm start
; Urllocalhost:4200
will be created
- For demo purposes open
localhost:4200
in 3 different windows with isolated Local Storages, e.g. 1 window in normal mode, 1 window in incognito mode, 1 window in a different browser - Log with user 1
- Set users 2 and 3 on the other two windows without login
- Click on each login button so you can see concurrent users
User 1
username: pedro
password: paramo
role: admin
User 2
username: emmanuel
password: deoca
role: user
User3
username: juan
password: delabarrera
role: user
Client:
- Go into client folder
- run
npm test
Note: Specs were created by angular cli.
Server:
- Go into server folder
- run
npm test
Note: Specs were created from scratch.
https://www.getpostman.com/collections/b699dfb15b23550b09fb
POST http://localhost:3000/login
BODY: {"username": "pedro","password": "paramo"}
POST http://localhost:3000/geo/locations
BODY: {"latitude":42.356483,"longitude":-71.062016}
HEADERS:
Authorization: Bearer {token}
Content-Type: application/json
GET http://localhost:3000/users/{userId}/geo/locations
HEADERS:
Authorization: Bearer {token}
Content-Type: application/json
Note: Specs were created from scratch.
- Login validates but it doesn't shows an error message
- There are guards to validate session across urls but some unwanted behaviors could still happen
- Deepstream socket keeps opened after logout and
- WS implementation still doesn't use jwt