grouping-n-go

module
v0.0.0-...-8561c97 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2023 License: BSD-3-Clause

README

Grouping-N Go lang version

A tiny API: Just shuffles the given names.

Setting up the project
  1. Install go lang
  2. Install task
  3. Install air
  4. Install migrate
  5. Run postgresql database server (e.g. docker run --rm -d -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres:14)
  6. Run task migrate to migrate local database
  7. Run task dev to start the app
  8. Request
curl localhost:1323/grouping -H 'Content-Type: application/json' -d '{"n": 2,"members": ["1","2","3","4","5","6","7","8"]}'
  1. And response
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 126
{
  "groups": [
    {
      "members": [
        "8",
        "7",
        "3",
        "2"
      ]
    },
    {
      "members": [
        "5",
        "1",
        "4",
        "6"
      ]
    }
  ],
  "id": "08d6277f-89aa-4da2-b2d6-627cd91fc749"
}

Directories

Path Synopsis
internal
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL