A Giter8 template for a Scala Akka HTTP application wich will be shipped with an Angular 6+ front end. To know more on how to create to create a new g8 template read the official documentation.
NOTE: SBT is used to instantiate the skeleton
Akka HTTP is an Akka module, originating from spray.io, for building reactive REST services with an elegant DSL. Akka HTTP is a great toolkit for building backends for single-page or mobile applications.
Akka provides a library to construct or consume such HTTP services by giving a set of tools to create HTTP services (and serve them) and a client that can be used to consume other services. These tools are particularly suited to streaming in and out a large set of data or real-time events by leveraging the underlying model of Akka Streams.
Choose a location on your file system for your project. The template will prompt you for a set of variables that will eventually init your new Scala/Angular project. Note that it can take from a few seconds to a few minutes for sbt to download dependencies.
To create your project, follow these steps:
- Open a console and change into the directory you selected for your project.
- Download an install SBT
- Run the following command:
$ sbt new sentenza/scala-akka-http-angular.g8
The template prompts for the a series of parameters. Press Enter to accept the defaults or specify your own values.
$ cd ui
$ npm install
And then, in order to load the development Angular server, one can simply execute ng serve
.
The skeleton has a few things to make life a little easier:
.editorconfig
file for indentation.gitignore
for obvious reasons
In the build.sbt
file I arbitrarily chose some common libraries I use quite frequently for the skeleton:
- [typesafe config][config] for parsing
application.properties
It has default application.properties
and logback.xml
resource files that are used.
Giter8 provides an useful command to test the templates locally. Hence, in order to test this template before committing any changes one can simply move one folder up from the root folder of the project and execute the following command:
g8 file://scala-akka-http-angular.g8/ --name=sahatest --force
g8 will then create a new folder named sahatest
where the template will be generated.
$ cd sahatest/
$ sbt
> project backend
> ~ compile