Javalin: URL wildcards for static files

Created on 27 Apr 2018  路  2Comments  路  Source: tipsy/javalin

Hi,

Use case:

We have a static folder with an index.html file with a modern framework like angular5... how can we get wildcards such that we can have a catch all route for a particular static file?
localhost/somepath -> static/index.html

QUESTION

All 2 comments

@nmpribeiro Static files are handled by Jetty, so what you can do is a little limited. I would suggest one of

  1. Redirect: app.get("*", ctx -> ctx.redirect("/index.html"));
  2. Read the HTML as a string: app.get("*", ctx -> ctx.html(readFile("/path/to/index.html")));

I see... those should work fine I see. Thanks @tipsy

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bvicenzo picture bvicenzo  路  3Comments

spinscale picture spinscale  路  3Comments

accron-1 picture accron-1  路  4Comments

MFernstrom picture MFernstrom  路  3Comments

valtterip picture valtterip  路  5Comments