Starter kit / project using ZIO 2.0, Scala 3, Quill and GraphQL with Postgresql database.
git clone <project repository url>
- Download and install docker.
- Run the start script:
./start.sh
to start the postgres docker image. You might needsudo
access to do the same. - Compile and run the examples:
sbt ~reStart
to start the RESTful API or
> sbt 'runMain rapidor.api.RestService'
[info] Server started on port 8888
- Try the various APIs:
> curl http://localhost:8888/customers
[{"name":"Joe Smith","age":44,"membership":"k","id":1,"hid":1},{"name":"Joe Rolland","age":55,"membership":"k","id":2,"hid":2}]
- Download GraphQL client from Altair GraphQL client
sbt 'runMain rapidor.graphql.GraphqlService'
to start the GraphQL server on
[info] running (fork) rapidor.graphql.GraphqlService
[info] Server started on port: 8877
- Use the graphql client and try running
query {
customers(age:44) {
name,
age,
membership
}
}
Using the POST address http://localhost:8877
sbt
and thenrun
inside will show you all applications available.
Follow the below steps,
docker exec -ti rapidor-api-starter-kit_postgres_1 /bin/bash
psql -U postgres -p 15432 -h localhost -d starterkit
Password ispassword
which can be changed easily in thedocker-compose.yml
file and also in theapplication.conf
file.