Run command via REST API in server.
- go compiler v1.21
first in once you must install dependencies used in this project by:
go mod tidythen, you can simple run API server by:
go run main.goyou can test API with test.sh script:
./test.shbuild project in to bin directory:
go build -o bin./bin/exec-api -p 9090
...request to server for running ls / command in server:
curl -XPOST http://localhost:9090/run -d '{"cmd":"ls /"}' -H "Content-Type: application/json"
...