Skip to content

CSR-LC/csr-be

Repository files navigation

What is this repo?

This CSR backend API.

  • GET /api/docs - swagger generated UI

How to run this code

Checked from unix-compatible OS. Go 1.22.5 is the current version.

  1. Install all necessary tools
    make setup
  2. Generate necessary go files (related to ent, swagger)
    make generate
  3. Run database
    make db
  4. Run the service:
    make run
    The server is here - http://127.0.0.1:8080/api Swagger docs are here - http://127.0.0.1:8080/api/docs
  5. Service cURL request example:
    curl -XPOST http://127.0.0.1:8080/api/v1/users/ -vvv
    *   Trying 127.0.0.1:8080...
    * Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
    > POST /api/v1/users/ HTTP/1.1
    > Host: 127.0.0.1:8080
    > User-Agent: curl/7.77.0
    > Accept: */*
    > 
    * Mark bundle as not supporting multiuse
    < HTTP/1.1 201 Created
    < Content-Type: application/json
    < Date: Tue, 15 Feb 2022 10:16:36 GMT
    < Content-Length: 20
    < Connection: close
    < 
    {"data":{"id":"1"}}

How to start project in docker compose

Before starting, you need to install git (https://git-scm.com/downloads) and docker (https://docs.docker.com/desktop/install/windows-install/) 0. Change in config.json db host to

"host": "postgres",
  1. Run the build container (pull updates and build):
    make rebuild_project
  2. Run the build container:
    make start_project

For developers

To draw entities relationships diagram:

go get -u github.com/a8m/enter
enter ./ent/schema

Files workflow

Files are stored in the file system. The name of the folder with files is set in environment variable PHOTOS_FOLDER. The database stores id - names of files without an extension

files workflow diagrams

About

Back-end application for CSR project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages