Similar to Intro to Scala
- Skip this step if you have already done Intro to Scala on your current machine. If you're going to use IntelliJ IDEA (Community edition is fine), you need to install Java 8 even if you have a newer version of Java installed.
brew tap homebrew/cask-versions
brew cask install homebrew/cask-versions/adoptopenjdk8
- Before the course, please run the following:
git clone git@github.com:realestate-com-au/applied-scala.git
cd applied-scala
./auto/test
./auto/start-local
This should start the app. Note that the tests should be failing at this point.
- Now test this out in a new tab.
curl http://localhost:9200/movies
You should get back [{"name":"Titanic"}]
. Now press ctrl+c
in the previous tab to shut down the app.
- Open up the project in IntelliJ IDEA and make sure it all compiles. Now you're ready to go!
Using Docker
./auto/sbt
or
Using portable SBT
./sbt
./auto/test
./auto/start-local
- IO Exercises
- Http4s overview + Endpoint 1: Hello World
- Circe Exercises
- Code walkthrough: GET all movies (no exercises)
- Endpoint 2: GET movie
- Endpoint 3: GET movie?enriched=true
- Validated Exercises
- Endpoint 4: POST movie
- Endpoint 5: POST movie/id/review
- Wrap up
Fetch all movies
$ curl http://localhost:9200/movies
Fetch movie
$ curl http://localhost:9200/movies/1
Fetch enriched movie
$ curl http://localhost:9200/movies/1?enriched=true
Save movie
- Successful save
$ curl -H "Accept: application/json" -X POST -d "{\"name\": \"Cars 3\", \"synopsis\": \"Great movie about cars\"}" http://localhost:9200/movies
- Validation errors
$ curl -H "Accept: application/json" -X POST -d "{\"name\": \"\", \"synopsis\": \"\"}" http://localhost:9200/movies
Save review
- Successful save
$ curl -H "Accept: application/json" -X POST -d "{\"author\": \"Jack\", \"comment\": \"Great movie huh\"}" http://localhost:9200/movies/1/reviews
- Validation errors
$ curl -H "Accept: application/json" -X POST -d "{\"author\": \"\", \"comment\": \"\"}" http://localhost:9200/movies/1/reviews