Skip to content

A native microservice that serves Reveal.js presentations

Notifications You must be signed in to change notification settings

bcopy/revealjs-microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraalVM Native Image builds

Reveal.js microservice

This microservice provides a native, self-standing executable to serve Reveal.js presentations over HTTP.

How to use it

  1. Simply download the executable for your given platform (Linux, Windows, Mac OSX are supported).
  2. Create a www folder to contain your presentation
  3. Create a resources folder to contain your binary and static resources (images, reveal.js plugins etc...)
  4. Create an index.html file in www to host your reveal.js presentation (Bonus : you can use Thymeleaf templating)
  5. Note that all reveal.js resources are available under /webjars/reveal.js/4.1.3/, for instance :
    • /webjars/reveal.js/4.1.3/dist/reveal.js
    • /webjars/reveal.js/4.1.3/plugin/notes/notes.js
    • /webjars/reveal.js/4.1.3/dist/reset.css
  6. Start the server with executing reveal-microservice and it will be available at http://localhost:8080/index.html

🗒 NOTE : Native compilation does not currently support the Webjars locator library, forcing us to use versioned URLs to access Reveal.js resources (c.f. Spring Framework issue 27619 and Webjars locator issue 96 )

Under the hood

This microservice is implemented using Spring Boot 3 and its amazing native image compilation support. As such, you can configure the microservice using any of the supported Spring Boot application properties.

All presentation templates are also Thymeleaf templates, which supports the injection of request parameters and other dynamic properties into your presentations.

One custom property available to you is the location of your reveal.js presentation (by default ./www/), you can override this by adding a parameter to the microservice execution (for instance if your files are stored in ./my-custom-folder) :

reveal-microservice --spring.thymeleaf.prefix=file:./my-custom-folder/

Please note that the path must end with a forward slash.

Static resources (e.g. images) are served from the folder ./resources/, you can also adjust this location like so :

reveal-microservice --spring.web.resources.static-locations=./my-other-resource-location/

How to develop

Pre-requisites

  • Java 17 GraalVM 22.3+
  • GraalVM Native image plugin

Building the Spring Boot application

Using the provided Maven wrapper, simply call :

./mvnw package

You can then run the service with :

./mvnw spring-boot:run

To compile the native image, please refer to HELP.md.

About

A native microservice that serves Reveal.js presentations

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages