Skip to content

Latest commit

 

History

History
127 lines (88 loc) · 2.93 KB

README.md

File metadata and controls

127 lines (88 loc) · 2.93 KB

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 11 even if you have a newer version of Java installed.
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk11
  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