0

I have the following code snippet:

final class UserRoutes[F[_]: Defer: JsonDecoder: MonadThrow](
    auth: Auth[F]
) extends Http4sDsl[F] {

  private[routes] val prefixPath = "/auth"
  private val httpRoutes: HttpRoutes[F] =
    HttpRoutes.of[F] {
      case req @ POST -> Root / "users" =>
        req
          .decodeR[CreateUser] { user =>
            auth
              .newUser(
                user.username.toDomain,
                user.password.toDomain
              )
              .flatMap(Created(_))
              .recoverWith {
                case UserNameInUse(u) =>
                  Conflict(u.value)
              }
          }
    }
  val routes: HttpRoutes[F] = Router(
    prefixPath -> httpRoutes
  )
}

that I do not understand the meaning of the expression private[routes] val prefixPath = "/auth". Could anyone please clarify the meaning of the expression?

softshipper
  • 32,463
  • 51
  • 192
  • 400
  • 3
    If you are still confused about simple syntax things like access modifiers, maybe going full into complex libraries like **cats** and **http4s** is not really a good idea. – Luis Miguel Mejía Suárez Jun 21 '20 at 14:39

1 Answers1

3

It means that the prefixPath member is only accessible on UserRoutes from the routes package.

cchantep
  • 9,118
  • 3
  • 30
  • 41