Skip to content

Commit b7f5fdf

Browse files
committed
minor text updates, demo calling client
1 parent 787af98 commit b7f5fdf

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

_scala_use_case_items/1-backend.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def fetch2 = fetchWeather(server2) // expensive Network IO
6565
<div class="scala-text scala-text-large">
6666
<h3>Case Study: Reusable Code with Tapir</h3>
6767
<p class="emph">Harness the “Code as Data” Paradigm: define once, use everywhere.</p>
68-
<p>Scala is a very flexible language. Its rich type system and metaprogramming facilities give the power to automatically derive helpful utilities from your code.</p>
68+
<p>Scala's rich type system and metaprogramming facilities give the power to automatically derive helpful utilities from your code.</p>
6969
<p>One such example library is <a href="https://tapir.softwaremill.com/en/latest/#" target="_blank" rel="none">Tapir</a>, letting you use Scala as a declarative language to describe your HTTP endpoints. From this single source of truth, you can automatically derive their server implementation, their client implementation, and both human-readable and machine-readable documentation.</p>
7070
<p>Because everything is derived from a type-safe definition, endpoint invocations are checked to be safe at compile-time, across the frontend and backend.</p>
7171
<a class="button button_call-to-action" href="https://tapir.softwaremill.com/en/latest/#" target="_blank" rel="none">Read more in the Tapir docs</a>
@@ -88,7 +88,9 @@ val server = serverBuilder(port = "8080")
8888
.addEndpoint(reportEndpoint.handle(fetchReport))
8989
.start()
9090
val client = clientReader
91-
.toRequest(reportEndpoint, "http://localhost:8080")</code></pre>
91+
.toRequest(reportEndpoint, "http://localhost:8080")
92+
val report: Future[Report] =
93+
client("5ca1a-78fc8d6") // call like any function</code></pre>
9294
</div>
9395
</div>
9496
</div>

_scala_use_case_items/4-frontend.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ icon: "icon8.svg"
1111
<div class="scala-code">
1212
<div class="scala-text scala-text-large">
1313
<h3>Portable Code and Libraries</h3>
14-
<p class="emph">Write the code once and have it run on the front-end as well as on the backend.</p>
14+
<p class="emph">Write the code once and have it run on the frontend as well as on the backend.</p>
1515
<p>Reuse the same libraries and testing frameworks on both sides. Write API endpoints that are typechecked across the stack.</p>
1616
<p>For example: define your data model in a shared module. Then use <a href="https://github.com/softwaremill/sttp" target="_blank" rel="none">sttp</a> to send data to the backend, all while <a href="https://github.com/com-lihaoyi/upickle" target="_blank" rel="none">upickle</a> handles seamless conversion to JSON, and also reads JSON back into your model on the backend.</p>
1717
<a class="button button_call-to-action" href="https://index.scala-lang.org/search?languages=3.x&languages=2.13&platforms=sjs1&q=*" target="_blank" rel="none">More Scala.js libraries and frameworks</a>
@@ -62,7 +62,7 @@ ReactDOM.render(Counter(0), mountNode)</code></pre>
6262
<h3>Poweful User Interface Libraries</h3>
6363
<p class="emph">Write robust UIs with the Scala.js UI libraries.</p>
6464
<p>Pick your preferred style: <a href="https://laminar.dev" target="_blank" rel="none">Laminar</a> for a pure Scala solution, <a href="https://slinky.dev" target="_blank" rel="none">Slinky</a> for the React experience, or <a href="https://tyrian.indigoengine.io" target="_blank" rel="none">Tyrian</a> or <a href="https://github.com/japgolly/scalajs-react" target="_blank" rel="none">scalajs-react</a> for the pure FP-minded developers.</p>
65-
<a class="button button_call-to-action" href="https://index.scala-lang.org/awesome/web-frontend?sort=stars&languages=3.x&languages=2.13&platforms=sjs0.6" target="_blank" rel="none">See more Scala.js libraries for frontend and UI</a>
65+
<a class="button button_call-to-action" href="https://index.scala-lang.org/awesome/web-frontend?sort=stars&languages=3.x&languages=2.13&platforms=sjs1" target="_blank" rel="none">See more Scala.js libraries for frontend and UI</a>
6666
</div>
6767
</div>
6868
<div class="scala-code">

0 commit comments

Comments
 (0)