Visar inlägg med etikett generate. Visa alla inlägg
Visar inlägg med etikett generate. Visa alla inlägg

2016-04-02

Webapp with HTML, CSS and JavaScript written in Scala

ISO Scala

This is an example of HTML, CSS and JavaScript written in Scala.

Technics

Different parts are written in different ways
  • Backend, Scala implementation of a Java Servlet
  • HTML and CSS, using ScalaTags to generate HTML in a String
  • JavaScript, built with ScalaJS

Two Builds

There are two different builds
  1. Backend, using plain Maven to build and setup the project
  2. JavaScript, built with SBT and using ScalaJS dependencies

Example

View a whole example at

2015-12-06

Infographic of Google Endpoints in both Scala and Scala JS

I'm no expert in infographics, but I'd tried to show how Google Endpoints is implemented in Scala and Scala JS.

Map

So there are three different languages:
  1. Scala
  2. Javascript
  3. HTML

Google Endpoints

When this is implemented in Scala on backend, it will generate Javascript. HTML needs to load the script and call a Javascript function when loaded.

Scala JS

Written in Scala, Scala JS will generate Javascript. When the Google Endpoints script is loaded, it will callback to Scala JS's script which will created either dynamic or facade representations of it.

Shared

Since Google Endpoints is implemented in Scala and frontend Javascripts in Scala JS, it's easy to share common logic with Scala code.

Code Example

A simple implementation can be found here: