Skip to content

Commit eb873f0

Browse files
tipsyjorunfa
andauthored
merge (#252)
* remove live demo references (closes #190) * add highlight to current selected menu element (closes #156) * add Bazel tutorial (#251) * add tutorial for bazel using template (kotlin) * fix line feed * add choco commands for deps * user fork of example repo --------- Co-authored-by: David (javalin.io) <[email protected]> * first version of 5-6 migration guide * add migration guide for jetty config * add migration guide for cfg/unsafeConfig * add migration for compression updates * add migration for misc changes * add migration for compression * fix typo * add Javalin#routes to migration guide * add migration for ctx#async * fix wrong code snippet in tutorial * migration guide for app attributes * add migration for plugins * add migration guide for virtual threads * create and start * add plugin howtto * omeglin tutorial --------- Co-authored-by: Jørund B. Fagerjord <[email protected]>
1 parent dc6589d commit eb873f0

24 files changed

+1865
-25
lines changed

Diff for: _includes/macros/importingDocsSnippet.html

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% capture java %}
2+
{% include_relative {{include.java}} %}
3+
{% endcapture %}
4+
{% capture kotlin %}
5+
{% include_relative {{include.kotlin}} %}
6+
{% endcapture %}
7+
{% include macros/docsSnippet.html java=java kotlin=kotlin %}

Diff for: _layouts/default.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<a id="logo" href="/" aria-label="Javalin">
2929
{% if page.splash %}<img src="/img/logo_inv.svg" alt="Javalin">{% else %}<img src="/img/logo.svg" alt="Javalin">{% endif %}
3030
</a>
31-
<ul>
31+
<ul class="top-nav">
3232
<li><a href="/documentation">Docs</a></li>
3333
<li><a href="/tutorials">Tutorials</a></li>
3434
<li><a href="/plugins">Plugins</a></li>

Diff for: _posts/tutorials/2017-05-27-javalin-vuejs-example.md

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ language: kotlin
1616
If you need to learn how to setup Kotlin with Maven, please
1717
follow the beginning of our [Kotlin CRUD REST API tutorial](/tutorials/simple-kotlin-example)
1818

19-
[A live demo can be found here](http://javalin-vuejs-example.herokuapp.com)
20-
2119
## Dependencies
2220
~~~markup
2321
<dependency>

Diff for: _posts/tutorials/2017-09-22-javalin-websocket-example.md

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ summary: Learn how to create a simple chat-app with WebSockets in Javalin
1111
language: ["java", "kotlin"]
1212
---
1313

14-
A live demo of this app can be found [here](http://javalin-websocket-example.herokuapp.com) (loads slowly first time)
15-
1614
## What You Will Learn
1715
In this tutorial we will create a simple real-time chat application.
1816
It will feature a chat-panel that stores messages received after you join,

Diff for: _posts/tutorials/2018-09-02-jetty-session-handling-java.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,12 @@ Since Javalin relies on Jetty for session handling can, you simply pass your `Se
237237

238238
{% capture java %}
239239
Javalin.create(config -> {
240-
config.sessionHandler(() -> fileSessionHandler());
240+
config.jetty.sessionHandler(() -> fileSessionHandler());
241241
}).start(7000);
242242
{% endcapture %}
243243
{% capture kotlin %}
244244
val app = Javalin.create {
245-
it.sessionHandler { fileSessionHandler() }
245+
it.jetty.sessionHandler { fileSessionHandler() }
246246
}.start(7000)
247247
{% endcapture %}
248248
{% include macros/docsSnippet.html java=java kotlin=kotlin %}

Diff for: _posts/tutorials/2023-11-13-javalin-bazel-example.md

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
layout: tutorial
3+
official: true
4+
title: "Setting up Javalin with Bazel & Kotlin using a template"
5+
author: <a href="https://www.linkedin.com/in/fagerjord/" target="_blank">Jørund B. Fagerjord</a>
6+
github: https://github.com/javalin/kotlin-javalin-bazel-starter
7+
date: 2022-11-30
8+
permalink: /tutorials/bazel
9+
summarytitle: Bazel setup
10+
summary: Run your Javalin app with Bazel, from a template project
11+
language: kotlin
12+
---
13+
14+
## About Bazel
15+
16+
[Bazel](https://bazel.build/) is a build tool that was created by Google. It's fast and correct, and it supports multiple languages. See [Why Bazel](https://bazel.build/about/why).
17+
18+
## What do you need?
19+
20+
- [Bazelisk](https://github.com/bazelbuild/bazelisk): A user-friendly launcher for Bazel. It will download the correct version of Bazel for you.
21+
- macOS: `brew install bazelisk`
22+
- Windows: `choco install bazelisk`
23+
- [git](https://git-scm.com/): To clone the project
24+
- macOS: `brew install git`
25+
- Windows: `choco install git`
26+
- <https://github.com/jorunfa/kotlin-javalin-bazel-starter>
27+
- In this tutorial we'll use *kotlin-javalin-bazel-starter* project on GitHub. Follow the steps below to get started.
28+
29+
## Steps
30+
31+
### 1. Use the template project
32+
33+
```bash
34+
git clone [email protected]:javalin/kotlin-javalin-bazel-starter my-javalin-app
35+
cd my-javalin-app
36+
```
37+
38+
### 2. Run the application
39+
40+
```bash
41+
bazel run //:server
42+
```
43+
44+
Should output something like:
45+
46+
```text
47+
Starting local Bazel server and connecting to it...
48+
INFO: Invocation ID: 84c2e9f4-6392-427c-ad4b-22f4fcd3010a
49+
INFO: Analyzed target //:server (61 packages loaded, 1022 targets configured).
50+
INFO: Found 1 target...
51+
Target //:server up-to-date:
52+
bazel-bin/server.jar
53+
bazel-bin/server
54+
INFO: Elapsed time: 5.741s, Critical Path: 4.47s
55+
INFO: 85 processes: 10 internal, 69 darwin-sandbox, 6 worker.
56+
INFO: Build completed successfully, 85 total actions
57+
INFO: Running command line: bazel-bin/server
58+
[main] INFO io.javalin.Javalin - Starting Javalin ...
59+
[main] INFO org.eclipse.jetty.server.Server - jetty-11.0.15; built: 2023-04-11T18:37:53.775Z; git: 5bc5e562c8d05c5862505aebe5cf83a61bdbcb96; jvm 20+36
60+
[main] INFO org.eclipse.jetty.server.session.DefaultSessionIdManager - Session workerName=node0
61+
[main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started i.j.j.@304bb45b{/,null,AVAILABLE}
62+
[main] INFO org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@7dc0f706{HTTP/1.1, (http/1.1)}{0.0.0.0:7070}
63+
[main] INFO org.eclipse.jetty.server.Server - Started Server@2f465398{STARTING}[11.0.15,sto=0] @267ms
64+
[main] INFO io.javalin.Javalin -
65+
__ ___ ______
66+
/ /___ __ ______ _/ (_)___ / ____/
67+
__ / / __ `/ | / / __ `/ / / __ \ /___ \
68+
/ /_/ / /_/ /| |/ / /_/ / / / / / / ____/ /
69+
\____/\__,_/ |___/\__,_/_/_/_/ /_/ /_____/
70+
71+
https://javalin.io/documentation
72+
73+
[main] INFO io.javalin.Javalin - Listening on http://localhost:7070/
74+
[main] INFO io.javalin.Javalin - You are running Javalin 5.6.1 (released June 22, 2023. Your Javalin version is 143 days old. Consider checking for a newer version.).
75+
[main] INFO io.javalin.Javalin - Javalin started in 180ms \o/
76+
```
77+
78+
### 3. Open the application in your browser
79+
80+
In a new terminal window, run:
81+
82+
```bash
83+
open http://localhost:7070
84+
```
85+
86+
Or just open <http://localhost:7070> in your browser.
87+
88+
Which should produce the following output:
89+
90+
```html
91+
Hello World
92+
```
93+
94+
## Conclusion
95+
96+
In this tutorial, we have:
97+
98+
1. Used a template project to get started with Javalin, Kotlin and Bazel
99+
2. Run the application with Bazel
100+
3. Opened the application in our browser

0 commit comments

Comments
 (0)