Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jxnu-liguobin/weather
Demo project: Scala 3,cats-effect 3,fs2-grpc,http4,circe,sangria
https://github.com/jxnu-liguobin/weather
cats-effect-3 fs2-grpc
Last synced: 5 days ago
JSON representation
Demo project: Scala 3,cats-effect 3,fs2-grpc,http4,circe,sangria
- Host: GitHub
- URL: https://github.com/jxnu-liguobin/weather
- Owner: jxnu-liguobin
- License: mit
- Created: 2023-03-23T13:55:58.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-03-28T03:58:09.000Z (over 1 year ago)
- Last Synced: 2024-10-12T13:29:37.371Z (about 1 month ago)
- Topics: cats-effect-3, fs2-grpc
- Language: Scala
- Homepage:
- Size: 258 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Weather
![CI][Badge-CI]
> Reference Project [weather-rpc](https://github.com/dimaopen/weather-rpc),It based on Scala 2 and cats 1, and does not use fs2-grpc and sangria
# Description
A web server that allows to get the current temperature at most of the big cities in the world.# Technology stack
- Scala 3
- cats-effect 3
- fs2-grpc
- http4s
- circe
- sangria# Running
* You need to run the server app. Go to the project dir and execute
```shell
sbt "weather-server/runMain bitlap.weather.server.WeatherApplication"
```## Client apps
There are 2 clients in the project:
1. a simple client that gets the temperature for a single city and sends a shutdown server command
2. a streaming client that gets the temperature for multiple cities in a stream mode.
This client does not stop the server.To run the simple client execute
```shell
sbt "weather-client/runMain bitlap.weather.client.SimpleWeatherClient"
```
To run the streaming client execute
```shell
sbt "weather-client/runMain bitlap.weather.client.StreamingWeatherClient"
```## http4s http
```
curl --location 'http://localhost:8888/weather' \
--header 'Content-Type: application/json' \
--data '{
"name": "Beijing",
"countryCode": "CN",
"region": "Beijing"
}'
```## sangria graphql
```
curl --location 'http://localhost:8888/graphql' \
--header 'Content-Type: application/json' \
--data '{"query":"query test {\n city(name:\"Beijing\",countryCode:\"CN\"){\n value\n }\n}","variables":{}}'
```[Badge-CI]: https://github.com/bitlap/weather/actions/workflows/ScalaCI.yml/badge.svg