Skip to content

faeldon/scala-api-boilerplate

Repository files navigation

Scala API Boilerplate License: MIT Build Status codecov Chat

A TypeLevel API Boilerplate inspired by scala-pet-store

Features

Getting Started

Setup PostgreSQL

  1. Install PostgreSQL 9.6+

  2. Initialize database (use password: "password01" as default)

cd scala-api-boilerplate
mkdir .db
initdb -D .db/api
pg_ctl -D .db/api start
createuser -d -s api -P
createdb api_local -O api
  1. Edit 'src/main/resources/reference.conf' to use new database settings or create an .env file and source it.
touch .env
echo 'export DB_DRIVER=org.postgresql.Driver' >> .env
echo 'export DB_URL=jdbc:postgresql://localhost:5432/api_local' >> .env
echo 'export DB_USER=api' >> .env
echo 'export DB_PASSWORD=password01' >> .env
echo 'export DB_POOL_SIZE=16' >> .env
source .env

Start API Service

  1. Start up sbt:
> sbt
  1. Once sbt has loaded, you can start up the application
> ~reStart

This uses revolver, which is a great way to develop and test the application. Doing things this way the application will be automatically rebuilt when you make code changes

  1. To stop the app in sbt, hit the Enter key and then type:
> reStop

Testing

Start up sbt:

> sbt

Once sbt has loaded, you can test the application

> test

Functional Test

In order to run the functional tests, your machine will need to have Python 3 and pip, and virtualenv.

  1. To install pip on a Mac, run sudo easy_install pip
  2. Then install virutalenv sudo pip install virtualenv

To test out the app, first start it up following the directions above and doing reStart

Then, in a separate terminal, run the test suite:

cd functional_test
./run.py live_tests -v

Contributing

Contributions are always welcome, no matter how large or small. Before contributing, please read the code of conduct.

About

Scala API Boilerplate using Typelevel Stack

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published