Application demonstrating Akka Http and Slick based CRUD
Scala
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
libexec
project
src
.gitignore
README.adoc
build.sbt
manifest.yml

README.adoc

Sample Demonstrating Akka Http and Slick based CRUD REST operations

This project demonstrates the Akka Http and Slick

Usage

Start up an instance of Mysql db:

brew install mysql
mysql.server start
mysql -u root

CREATE USER 'myuser'@'LOCALHOST' IDENTIFIED BY 'mypass';
CREATE DATABASE sampledb;
GRANT ALL ON sampledb.* TO 'myuser'@'localhost';

Start services with sbt:

$ sbt
> ~re-start

Create a Hotel

curl -X "POST" "http://localhost:8080/hotels" \
       -H "Accept: application/json" \
       -H "Content-Type: application/json" \
       -d $'{
  "name":"Stamford Hotel",
  "address": "Stamford",
  "state": "ct",
  "zip": "97006"
  }'

Get All Hotels

curl -X "GET" "http://localhost:8080/hotels"

Get A Hotel

curl -X "GET" "http://localhost:8080/hotels/1"

Update Hotel

curl -X "PUT" "http://localhost:8080/hotels/1" \
     -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -d $'{
"id": 1,
"name":"Stamford Hotel Updated",
"address": "Stamford",
"state": "ct",
"zip": "97006"
}'

Delete Hotel

curl -X "DELETE" "http://localhost:8080/hotels/1" \
     -H "Accept: application/json" \
     -H "Content-Type: application/json"

Deploying to Cloud Foundry:

cf create-service p-mysql 512mb sampledb
cf push

Acknowledgement

This project is heavily based on https://github.com/ArchDev/akka-http-rest project.