-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from kostaskougios/0.30d
0.30d
- Loading branch information
Showing
119 changed files
with
4,328 additions
and
2,129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Running applications on the server | ||
|
||
To create an app that runs on the server, implement the `ServerSideApp` trait and then pass your implementation to the `start()` method of the server: | ||
|
||
```scala | ||
class MyServerApp extends ServerSideApp: | ||
override def name = "My Server App" | ||
|
||
override def description = "Some app that I want to be available when I start the server" | ||
|
||
override def createSession(serverSideSessions: ServerSideSessions, dependencies: Dependencies): Unit = | ||
serverSideSessions | ||
.withNewSession("my-server-app-session", name) | ||
.connect: session => | ||
given ConnectedSession = session | ||
... your app code ... | ||
``` | ||
|
||
See for example the [default terminal21 apps](../terminal21-server-app/src/main/scala/org/terminal21/serverapp/bundled). | ||
|
||
Now make sure your app is included in the server's classpath and then pass it as an argument to `start()`, i.e. with this `scala-cli` script: | ||
|
||
```scala | ||
//> ... | ||
//> using dep MY_APP_DEP | ||
|
||
import org.terminal21.server.Terminal21Server | ||
|
||
Terminal21Server.start(apps = Seq(new MyServerApp)) | ||
``` | ||
|
||
Now start the server and the app should be available in the app list of terminal21. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.