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.

Provide a way to set the root context path

See original GitHub issue

If a user wants to add a context path for all endpoints, he/she has to add the prefix string to all service setters which is tedious. If we provide a way to set the context path, it will be much easier:

Server.builder()
      .contextPath("/api")
      .service("/foo", myService) // myService binds to "/api/foo"
      ...

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
vivekkotharicommented, Oct 23, 2021

Sure… i’lll try work on this over the next week.

1reaction
AngerM-DDcommented, May 28, 2021

Would it make sense to allow building ‘sub routers’? It may end up just being some syntactical sugar but it would be great to have something like:

val builder = Server.builder()
builder.<Add top level http functions>

val api = builder.subRouter("/api")
api.<Add your http handler functions that will get run under /api>

etc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot Change Context Path - Baeldung
The most straightforward way of changing the context path is to set the property in the application.properties/yml file:
Read more >
Setting the Context Root (The Java EE 5 Tutorial)
Setting the Context Root. A context root identifies a web application in a Java EE server. You specify the context root when you...
Read more >
Chapter 6. Setting the context root of a web application
For web applications that are deployed outside an EAR file, the context root can be specified in two ways. First, the context root...
Read more >
How to change context root of a dynamic web project in Eclipse?
14 Answers 14 · In your project's Properties, choose Web Project Settings. · Change Context root to app. · Choose Window > Show...
Read more >
Spring Boot context path - ZetCode
The context path can be changed in many ways. We can set it in the properties file, with the SERVER_SERVLET_CONTEXT_PATH environment variable, ...
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