Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lolgab
Copy link
Contributor

@lolgab lolgab commented Oct 18, 2025

The Scala Native build is commented out since http4s has not been released yet for Scala Native.

import ba.sake.sharaf.*
import ba.sake.sharaf.http4s.*

import cats.effect.*
import com.comcast.ip4s.*
import org.http4s.ember.server.*

val routes = Routes {
  case GET -> Path("hello", name) =>
    Response.withBody(s"Hello ${name}!")
  case _ =>
    Response.withBody("Hello Http4s!")
}

object Main extends IOApp.Simple:
  def run =
    EmberServerBuilder
      .default[cats.effect.IO]
      .withHost(ipv4"0.0.0.0")
      .withPort(port"8080")
      .withHttpApp(SharafHttpApp(SharafHandler.routes(routes)))
      .build
      .useForever

Copy link
Owner

@sake92 sake92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff!

Hope noone gets offended by runUnsafeSyncs.. 😝

@sake92 sake92 merged commit 11ac644 into sake92:main Oct 18, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants