Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 1.7 KB

README.md

File metadata and controls

36 lines (23 loc) · 1.7 KB

Scala http4s htmx Demo

A very simple demonstration of the use of htmx with a http4s server together with twirl templates.

This application implements the classic 'To Do' application with a database (JDBC) backend.

Using this Project

Requirements: JDK >= 17 and Sbt.

Once Java & sbt are installed, clone this project, and run sbt run from the project root.

You should see this line in the console: -

2024-01-17 19:50:25.464 INFO  [io-compute-5] n.m.d.HtmxDemoServer - Ember-Server service bound to address: [::]:8080

Point your browser to http://localhost:8080 and you should see the following page: -

todo app

Logging

Change the logback.xml file to see/hide debug messages.

Database

The code uses an (in memory) h2 database by default. The JDBC connection parameters are stored in application.properties.

Details

  • The database integration is implemented with Doobie a pure functional JDBC layer for Scala and Cats
  • WebJars are used to install and manage Bootstrap, and htmx. More information on using WebJars with http4s.
  • The project also includes the sbt-revolver plugin. This means you can use the command ~ reStart on the sbt commandline and the server will restart on any code change.