question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rewrite configuration setup

See original GitHub issue

I’ve been playing around a bit with configuration: https://github.com/tipsy/javalin/pull/507

The general idea is to move away from app.enabledXyz methods, and to reduce the amount of methods on the Javalin class:

val app = Javalin.create().config { c ->
    c.contextPath = "/"
    c.caseSensitiveUrls = false
    c.devLogging = true
    c.requestLogger { ctx, ms ->
        println("${ctx.method()} ${ctx.path()}, took $ms}")
    }
    c.server { Server() }
    c.addStaticFiles("/public")
    c.addSinglePageHandler("/", "/public/subpage/index.html")
}.start()

Any thoughts?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
tipsycommented, Apr 3, 2019

Alternative:

val app = Javalin.create().configure { server, servlet ->
    server.contextPath = "/"
    server.caseSensitiveUrls = false
    server.server { Server() }
    servlet.devLogging = true
    servlet.requestLogger { ctx, ms ->
        println("${ctx.method()} ${ctx.path()}, took $ms}")
    }
    servlet.addStaticFiles("/public")
    servlet.addSinglePageHandler("/", "/public/subpage/index.html")
}.start(0)
1reaction
tipsycommented, Mar 23, 2019

It’s not really a feature of Javalin, it’s reading a file and mapping it to a Kotlin/Java object. I see that a lot of people are confused about this, so I can write a tutorial after Javalin 3 is done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating Rewrite Rules for the URL Rewrite Module
Summary. In this walkthrough, you have learned how to configure URL rewrite rules by using IIS manager or by manually editing Web.config files....
Read more >
Set Up and Use the IIS URL Rewrite Module (Step by Step)
Learn how to securely redirect URLs and fix broken links to your website with the IIS URL Rewrite module on your server in...
Read more >
How to Configure mod_rewrite {With 5 Practical Examples}
mod_rewrite helps rewrite URLs. Learn how to set up and get started with URL rewriting through useful examples in this guide.
Read more >
Apache Tomcat 9 (9.0.70) - The rewrite Valve
The rewrite valve can be configured as a valve added in a Host. See virtual-server documentation for information on how to configure it....
Read more >
How To Set Up Mod_Rewrite - DigitalOcean
Section 3—How to Rewrite URLS · RewriteRule: This is the section in which you can write in the name of the the mod_rewrite...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found