https://github.com/dragosv/matrix
Matrix web server
https://github.com/dragosv/matrix
Last synced: 3 months ago
JSON representation
Matrix web server
- Host: GitHub
- URL: https://github.com/dragosv/matrix
- Owner: dragosv
- License: mpl-2.0
- Created: 2021-07-30T20:24:21.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-09T16:36:26.000Z (over 3 years ago)
- Last Synced: 2025-02-01T13:28:29.509Z (5 months ago)
- Language: Go
- Size: 127 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Matrix
[](https://www.repostatus.org/#wip)
[](https://ci.appveyor.com/project/dragosv/matrix)
[](https://codecov.io/gh/dragosv/matrix)
[](https://goreportcard.com/report/github.com/dragosv/matrix)
[](https://sonarcloud.io/summary/new_code?id=dragosv_matrix)Basic web server written in GoLang that performs operations on a matrix
## Build and Run
To build and run the web server the following commands needs to executed at the terminal
```
go mod download
go mod verify
go build .
go run .
```## Api
The description of the API can be accessed while the server is running at http://localhost:8080/swagger/index.html### Echo
Return the matrix as a string in matrix format.```
curl -F 'file=@/path/matrix.csv' "localhost:8080/echo"// Expected output
1,2,3
4,5,6
7,8,9
```
### Invert
Return the matrix as a string in matrix format where the columns and rows are inverted
```
curl -F 'file=@/path/matrix.csv' "localhost:8080/invert"// Expected output
1,4,7
2,5,8
3,6,9
```
### Flatten
Return the matrix as a 1 line string, with values separated by commas.
```
curl -F 'file=@/path/matrix.csv' "localhost:8080/flatten"// Expected output
1,2,3,4,5,6,7,8,9
```
### Sum
Return the sum of the integers in the matrix. Will return bad request if the addition overflows.
```
curl -F 'file=@/path/matrix.csv' "localhost:8080/sum"// Expected output
45
```
### Multiply
Return the product of the integers in the matrix. Will return bad request if the multiplication overflows.
```
curl -F 'file=@/path/matrix.csv' "localhost:8080/multiply"// Expected output
362880
```## Organization
The http handlers are located in the handlers folder while the corresponding business commands are in the commands folder