World Conquest Chronicles

World Conquest Chronicles

go-exercises-backend, v1.0-alpha

Back-end of the service for solving programming exercises.

Alpha of the major version. Implement the task model, implement a server; prepare distribution via Docker.

Features

  • RESTful API:
    • models:
      • task model:
        • storing:
          • title;
          • description;
          • boilerplate code;
          • test cases:
            • all test cases are represented by a single string;
        • operations:
          • getting all tasks;
          • getting a single task by an ID;
          • creating;
          • updating by an ID;
          • deleting by an ID;
    • representing:
      • in a JSON:
        • payloads:
          • of requests;
          • of responses;
      • as a plain text:
        • errors;
  • server:
    • storing settings in environment variables;
    • supporting graceful shutdown;
    • logging:
      • logging requests;
      • logging errors;
    • panics:
      • recovering on panics;
      • logging of panics;
  • databases:
  • distributing:

Installation

Prepare the directory:

$ mkdir --parents "$(go env GOPATH)/src/github.com/thewizardplusplus/"
$ cd "$(go env GOPATH)/src/github.com/thewizardplusplus/"

Clone this repository:

$ git clone https://github.com/thewizardplusplus/go-exercises-backend.git
$ cd go-exercises-backend

Install dependencies with the dep tool:

$ dep ensure -vendor-only

Build the project:

$ go install ./...

Usage

$ go-exercises-backend

Environment variables:

  • SERVER_ADDRESS — server URI (default: :8080);
  • STORAGE_ADDRESSPostgreSQL connection URI (default: postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable).

Repository

Link: https://github.com/thewizardplusplus/go-exercises-backend/tree/v1.0-alpha.

Content: code.

License: MIT.

Screenshots

POST /api/v1/tasks/ route in the Postman tool

GET /api/v1/tasks/{id} route in the Postman tool

PUT /api/v1/tasks/{id} route in the Postman tool

DELETE /api/v1/tasks/{id} route in the Postman tool