Skip to content

martinprobson/http4s-htmx-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A simple demo of the use of htmx with a http4s server together with twirl templates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published