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 tidy
then, you can simple run API server by:
go run main.go
you can test API with test.sh script:
./test.sh
build 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"
...