fancellu / zio-restful-webservice

ZIO 2.0 Restful webservice example using zio, zio-http, zio-json, quill, H2, twirl, zio-streams, zio-cache, zio-logging, zio-actors, zio-spark, openai, DallE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZIO Restful webservice example

Using zio 2.0, zio-http, zio-json, quill, H2, twirl, zio-logging, zio-cache, zio-actors, zio-spark, openai

Now targeting zio-http 0.0.3

Apps

NoEnvApp

(no use of Environment)

HelloWorldApp

(Takes a String param via serviceAt Map as app root name)

HelloWorldTwirlApp

(Takes a String param and uses Twirl for HTML rendering)

DownloadApp

(Downloads a file in one go, and streaming, slowly)

CounterApp

(Stateful use of Ref)

VideoApp

(In memory and H2+Quill)

DelayApp

(Semantically sleeps for a while, no thread blocking, useful for emulating slow queries)

StreamApp

(Some streaming examples)

ClientApp

(Client examples talking to external web service https://jsonplaceholder.typicode.com/)

Downloads anime from https://api.waifu.pics/many/sfw/waifu into resources/waifu dir

StaticApp

(Static file server from static dir)

ActorsApp

OpenAICompletionApp

(Modelled after https://github.com/openai/openai-quickstart-python.git)

To use it you'll have to fill in your OpenAI OPENAI_API_KEY

OpenAIDallEApp

OpenAIModerationApp

CookieAuthApp

FormApp

Parallel server on port 8082

To run

sbt run

You should find it running on http://localhost:8080/

About

ZIO 2.0 Restful webservice example using zio, zio-http, zio-json, quill, H2, twirl, zio-streams, zio-cache, zio-logging, zio-actors, zio-spark, openai, DallE


Languages

Language:Scala 99.3%Language:HTML 0.7%