- Node.js (10.22.0)
- Typescript (4.1.3)
- Jest (26.6.3)
- Lodash (4.17.20)
- Install node packages
npm install - Build project
npm run build - Run application
npm run start
- Clean up build files
npm clean - Build project files
npm run build - Start application
npm run start - Start application in develop mode
npm run dev - Run unit tests
npm run test - Run single unit test
npm run test:watch <path to test file>
Application configuration file: .env
-
Create new maze game:
POST /pony-challenge/mazeRequest body parameters:{ "maze-width": 15, "maze-height": 20, "maze-player-name": "string" }Possible responses:
400 - Invalid request body parameters201 - Successfully created new game
{ "maze_id": 1 } -
Get current maze status
GET /pony-challenge/maze/:mazeIdRequest parameter:mazeId(ID of maze which info you want to receive) Possible responses:400 - Invalid maze ID parameter404 - Maze with ID not found203 - Successfully found desired maze and returned data
{ "playerLocation": { "x": 0, "y": 0 }, "monsterLocation": { "x": 0, "y": 0 }, "walkableDirections": ["left", "right", "top", "bottom"]; } -
Make next move in the maze:
POST /pony-challenge/maze/:mazeIdRequest parameter:mazeId(ID of maze in which you want to make a move) Request body parameters:{ "direction": "left" }Possible directions:
left, right, up, downPossible responses:400 - Invalid maze ID parameter400 - You are trying to move into not walkable direction404 - Maze with ID not found200 - Game is already finished200 - You won/lost the game200 - Successfully made a move
-
Print current maze view
GET /pony-challenge/maze/:mazeId/printRequest parameter:mazeId(ID of maze which you want to print) Possible responses:400 - Invalid maze ID parameter404 - Maze with ID not found200 - Successfully returned maze HTML