/go-command-runner-api

Run command via REST API in server.

Primary LanguageGo

go-command-runner-api

Run command via REST API in server.

Requirements

  • go compiler v1.21

Debug

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

build project in to bin directory:

go build -o bin

Usage

./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" 
...