Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iskyd/tic-tac-toc-api
https://github.com/iskyd/tic-tac-toc-api
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/iskyd/tic-tac-toc-api
- Owner: iskyd
- Created: 2022-02-17T13:40:50.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-17T13:41:05.000Z (almost 3 years ago)
- Last Synced: 2025-01-03T03:36:20.308Z (17 days ago)
- Language: JavaScript
- Size: 29.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Run
This will run the server on port 3000, if you need to change it just env variable PORT
```sh
npm install
npm start
```# Game play (row win)
Player 1 win in the first row```sh
curl -XPOST http://localhost:3000/start
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 1, "position": [0,0]}'
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 2, "position": [2,2]}'
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 1, "position": [0,1]}'
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 2, "position": [1,1]}'
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 1, "position": [0,2]}'
```Game play (column win)
Player 1 win in the middle column```sh
curl -XPOST http://localhost:3000/start
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 1, "position": [1,1]}'
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 2, "position": [0,0]}'
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 1, "position": [0,1]}'
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 2, "position": [2,2]}'
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 1, "position": [2,1]}'
```Game play (diagonal win)
Player 1 win in diagonal```sh
curl -XPOST http://localhost:3000/start
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 1, "position": [0,0]}'
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 2, "position": [0,1]}'
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 1, "position": [1,1]}'
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 2, "position": [0,2]}'
curl -XPOST localhost:3000/play/ -H 'Content-Type: application/json' -d '{"player": 1, "position": [2,2]}'
```