Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/y2k2mt/grouping-n
A tiny API: Just shuffles the given names.
https://github.com/y2k2mt/grouping-n
akka cats-mtl dependency-injection doobie eff-monad functional-programming http4s monix scala zio
Last synced: 22 days ago
JSON representation
A tiny API: Just shuffles the given names.
- Host: GitHub
- URL: https://github.com/y2k2mt/grouping-n
- Owner: y2k2mt
- Created: 2021-03-02T00:03:58.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-27T06:39:08.000Z (almost 3 years ago)
- Last Synced: 2024-11-09T14:45:09.824Z (3 months ago)
- Topics: akka, cats-mtl, dependency-injection, doobie, eff-monad, functional-programming, http4s, monix, scala, zio
- Language: Scala
- Homepage:
- Size: 48.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Grouping-N
A tiny API: Just shuffles the given names.
|project | description|
|--------|------------|
|mtl | Sample project of [http4s](https://http4s.org/) + [doobie](https://github.com/tpolecat/doobie) + [cats-effect](https://typelevel.org/cats-effect) with [cats-mtl](https://github.com/typelevel/cats-mtl)|
|akka | Sample project of [Akka http](https://doc.akka.io/docs/akka-http/current/index.html) + [Akka (stateful) actor + persistence](https://doc.akka.io/docs/akka/current/typed/actors.html)|Enjoy!
### Setting up the project
1. [Install Java 8+](https://jdk.java.net/)
1. Run postgresql database server (e.g. `docker run --rm -d -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres:13`)
1. Run `./sbt run` to start the app
1. Request
```
curl localhost:8080/grouping -H 'Content-Type: application/json' -d '{"n": 2,"members": ["1","2","3","4","5","6","7","8"]}'
```
5. And response
```
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 126
{
"group": {
"groups": [
{
"members": [
"8",
"7",
"3",
"2"
]
},
{
"members": [
"5",
"1",
"4",
"6"
]
}
]
},
"id": "08d6277f-89aa-4da2-b2d6-627cd91fc749"
}```