小编Tha*_*ane的帖子

Akka HTTP:找不到请求的资源

我在Akka HTTP 中的第一步使用Akka HTTP“最小示例”。

private Route createRoute() {
  return route(
    path("hello", () ->
      get(() ->
        complete("<h1>Say hello to akka-http</h1>"))));
}
Run Code Online (Sandbox Code Playgroud)

现在我想向 my 中添加一个路由resources/web/test.html,类似于“指令”页面上的示例:

private Route createRoute() {
  return route(
    pathSingleSlash(() ->
      getFromResource("web/test.html")
    ),
    path("hello", () ->
      complete("<h1>Say hello to akka-http</h1>")));
}
Run Code Online (Sandbox Code Playgroud)

但http://localhost:8080向我展示了以下内容:

The requested resource could not be found.
Run Code Online (Sandbox Code Playgroud)

java akka-http

6
推荐指数
0
解决办法
1143
查看次数

标签 统计

akka-http ×1

java ×1