-
-
Notifications
You must be signed in to change notification settings - Fork 638
[javalin] Move routing to config #2479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request refactors Javalin's routing API by moving route definitions from the Javalin instance to a new config.routes configuration object. The change shifts from app.get("/path") to config.routes.get("/path") within the create block, centralizing route configuration and aligning it with other framework settings.
Key Changes:
- Introduces a new
RoutesConfigclass that provides direct access to HTTP verbs and routing methods - Routes are now defined within the
Javalin.createconfiguration block usingconfig.routes.* - Removes routing methods from the
Javalinclass itself (no longer implementsJavalinDefaultRoutingApi) - Updates all example files, tests, and plugins to use the new routing API
Reviewed Changes
Copilot reviewed 129 out of 129 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| javalin/src/main/java/io/javalin/config/RoutesConfig.kt | New configuration class providing routing API within config blocks |
| javalin/src/main/java/io/javalin/config/JavalinConfig.kt | Adds routes field to expose the new RoutesConfig |
| javalin/src/main/java/io/javalin/Javalin.java | Removes routing methods, no longer implements JavalinDefaultRoutingApi |
| javalin/src/main/java/io/javalin/config/RouterConfig.kt | Removes deprecated mount() and apiBuilder() methods |
| javalin/src/test/java/io/javalin/testing/JavalinTestUtil.java | New utility providing app.verb() syntax for tests via static methods |
| javalin/src/test/java/io/javalin/testing/JavalinTestExtensions.kt | Extension functions maintaining app.verb() syntax for Kotlin tests |
| javalin/src/test/kotlin/io/javalin/examples/*.kt | Updates example files to use config.routes API |
| javalin/src/main/java/io/javalin/plugin/bundled/*.kt | Updates plugins to use config.routes for route registration |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2479 +/- ##
============================================
- Coverage 86.41% 86.32% -0.10%
+ Complexity 1462 1450 -12
============================================
Files 149 150 +1
Lines 4668 4658 -10
Branches 490 490
============================================
- Hits 4034 4021 -13
- Misses 409 412 +3
Partials 225 225 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: tipsy <[email protected]>
No description provided.