Created by: Farsky
Created date: 2021-10-24
========
This documentation is intented for the interviewers of this test (Edmund Gair and Anna Polubatko). The following steps will help you review this repository.
- Open the terminal of your choice from the root folder (cmd/Powershell/etc)
- Type
npm install
to restore essential libraries - Type
npm run start
to start the application. - Browse
http://localhost:3000
to see the map. - The exits are marked with a green icon and will display their names when hovering.
- The zones A-P are marked with black dot icons and have their names display above the dot.
- To enable/disable an exit entrance:
- Open Developer Console in your browser (the hotkey is usually F12 or Ctrl-Shift-I).
- Execute script
ViatickMap.toggleExit(name, isActive)
name
is the display text over each exit (case-sensitive)isActive
takes a boolean value,true
will enable the exit andfalse
will disable the exit.
- The marker will change from green to red when the exit is disabled.
- To indicate that a location is on fire:
- Open Developer Console in your browser (the hotkey is usually F12 or Ctrl-Shift-I).
- Execute
ViatickMap.toggleLocation(name, isOnFire)
name
is the display text over each zone (case-sensitive)isOnFire
takes a boolean value,true
indicates the location is on fire andfalse
removes the indication.
- The marker will change from black to red when the location is on fire.
- To show the escape route from zone A - P to the nearest exit:
- Open Developer Console in your browser (the hotkey is usually F12 or Ctrl-Shift-I).
- Execute script
ViatickMap.drawEscapeRoute(name)
name
is the display name of a zone.- For example, execute
ViatickMap.drawEscapeRoute('Zone D')
will draw a blue dotted path from 'Zone D' to 'Exit 2'.
- NOTE: The exits aren''t part of the returning JSON by Mappedin, I can only draw the route from a zone to the location nearest to the exit.
- To clear the escape route:
- Open Developer Console in your browser (the hotkey is usually F12 or Ctrl-Shift-I).
- Execute script
ViatickMap.clearEscapeRoute()
- To test the API, type
npm run test
Endpoint | Method | Description |
---|---|---|
/api/exits | GET | Get all exits |
/api/exits/active | GET | Get all active exits |
/api/exits/:id/:isActive | PUT | Enable/disable an exit |
Endpoint | Method | Description |
---|---|---|
/api/locations | GET | Get all locations |
/api/locations/active | GET | Get all active locations (not on fire) |
/api/locations | POST | Register a Location (this location will be able to have an escape route) Body: { locationId: string } |
/api/locations/:id/:isOnFire | PUT | Toggle fire warning on a Location |
/api/locations/:id | DELETE | Unregister a Location |