

We will start by instantiating the dependencies required to create a server with Akka HTTP.įirst, the object will extend the App trait: object Server extends App Let’s create a Scala object under “src/main/scala” named Server.
SCALA HELLO WORLD UPDATE
Then run sbt update to get the dependencies.Īuto-import will make sure to update your project every time certain files are updated, including the build.sbt file. Otherwise you can open a terminal and cd into the root directory of your project. If you’re prompted to enable auto-import, do it. Because Akka HTTP depends on actors and streams, we’ll need to add those libraries as well.Īdd the following snippet at the end of your build.sbt file: libraryDependencies ++= Seq( "" %% "akka-actor" % "2.5.13", "" %% "akka-stream" % "2.5.13", "" %% "akka-http" % "10.1.3",) Let’s start by adding the required dependencies. Check your build.properties and build.sbt files to make sure the versions there match these. If not, we’ll be using sbt 1.1.6 and Scala 2.12.6. Without further ado, let’s build a hello world API using Scala and Akka HTTP! Project setupįeel free to clone the repo, make sure you are using the branch 2.1-review-project. If that’s not the case, check the official docs.
/userfiles/images/first-code-1.jpg)
You should be familiar with Scala, and you should have SBT and IntelliJ setup and installed. We will focus on the server in this tutorial. It has several modules that help to build such applications, and Akka HTTP is one of them.Īkka HTTP has both client-side and server-side utilities. These applications mostly use Scala or Java. Photo by Blake Connally on UnsplashĪkka is a popular actor-based toolkit for building concurrent and distributed applications in the JVM. By Miguel Lopez How you can build a Hello World API with Scala and Akka HTTP Yes, it’s still a thing.
