Skip to content

realestate-com-au/applied-scala

Repository files navigation

applied-scala

Build Status

Getting Started

Similar to Intro to Scala

  1. 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
  1. Before the course, please run the following:
git clone [email protected]: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.

  1. 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.

  1. Open up the project in IntelliJ IDEA and make sure it all compiles. Now you're ready to go!

Open up SBT

Using Docker

./auto/sbt

or

Using portable SBT

./sbt

Run test

./auto/test

How to start app

./auto/start-local

Suggested Format

Day 1

Day 2

Further reading

Test queries

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

  1. Successful save
$ curl -H "Accept: application/json" -X POST -d "{\"name\": \"Cars 3\", \"synopsis\": \"Great movie about cars\"}" http://localhost:9200/movies
  1. Validation errors
$ curl -H "Accept: application/json" -X POST -d "{\"name\": \"\", \"synopsis\": \"\"}" http://localhost:9200/movies

Save review

  1. Successful save
$ curl -H "Accept: application/json"  -X POST -d "{\"author\": \"Jack\", \"comment\": \"Great movie huh\"}" http://localhost:9200/movies/1/reviews
  1. Validation errors
$ curl -H "Accept: application/json"  -X POST -d "{\"author\": \"\", \"comment\": \"\"}" http://localhost:9200/movies/1/reviews

About

A series of exercises to apply your Scala knowledge

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published