A simple, extensible Go service that lets you enqueue and track long-running I/O-bound jobs (3–5 minutes) entirely in memory, without any external databases or message brokers.
🥂 Clean architecture
🍓 Standard Go-project layout
🌸 Easy to use commands
🐳 Docker, Docker-compose
💥 Easy to expand
🤡 Stub server simulates I/O bound tasks
Clone the project
git clone https://github.com/shishmarevv/http_io_boundcd http_io_boundBuild images
make buildRun
make upLogs
make logsExit
make downInstall dependence
go mod downloadRun API
make run-apiRun Stub-server
make run-stubOpen shell
make CLIUse taskcli [command]
taskcli helpTo run tests, write following
go test -v ./...internal/web/handlers.go
func (handler *Handler) CreateTask(writer http.ResponseWriter, request *http.Request) {
errlog.Post("Got JSON, Decoding...")
var taskrequest TaskRequest
if err := json.NewDecoder(request.Body).Decode(&taskrequest); err != nil {
errlog.HTTPCheck(writer, "invalid JSON payload", http.StatusBadRequest)
return
}
errlog.Post("Creating Task...")
var fn func(context.Context) (string, error)
switch taskrequest.Type {
case "stub":
fn = task.IoTask
//INSERT NEW TYPE AND ITS LOGIC HERE
default:
errlog.HTTPCheck(writer, "unknown task type", http.StatusBadRequest)
return
}
id := handler.Manager.CreateTask(fn)
errlog.Post(fmt.Sprintf("Created Task ID: %s", id))
writer.Header().Set("Location", "/tasks/"+id)
writer.WriteHeader(http.StatusAccepted)
}- Add new .go file to cmd/taskcli/create
- cmd/taskcli/create/create.go
func init() {
Cmd.AddCommand(
stub, //INSERT NEW TYPE
)
}Author: Viktor Shishmarev
Github: @shishmarevv
LinkedIn: shishmarevv


