Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/buntec/minimal-scala-native-http4s-server-app
https://github.com/buntec/minimal-scala-native-http4s-server-app
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/buntec/minimal-scala-native-http4s-server-app
- Owner: buntec
- Created: 2023-10-02T16:39:02.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-29T17:06:51.000Z (about 1 year ago)
- Last Synced: 2024-10-29T20:50:50.789Z (about 2 months ago)
- Language: Nix
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A toy web server written in Scala using [http4s](https://http4s.org/)
The point of this project is to demonstrate how [scala-cli](https://scala-cli.virtuslab.org/)
and [nix flakes](https://nixos.wiki/wiki/Flakes) can be leveraged to build and distribute
Scala apps in 4 different ways:
- as a standalone jar running on the JVM;
- as a native executable compiled by [Scala Native](https://scala-native.org/en/latest/);
- as a [GraalVM native image](https://www.graalvm.org/latest/reference-manual/native-image/);
- as a Node.js app compiled by [Scala.js](https://www.scala-js.org/).If you have [nix](https://nixos.org/download.html) installed and [flakes enabled](https://nixos.wiki/wiki/Flakes#Enable_flakes):
```shell
nix run github:buntec/minimal-scala-native-http4s-server-app#jvm --refreshnix run github:buntec/minimal-scala-native-http4s-server-app#native --refresh
nix run github:buntec/minimal-scala-native-http4s-server-app#graal --refresh
nix run github:buntec/minimal-scala-native-http4s-server-app#node --refresh
```Note that running any of the above will be slow the first time only -
after the initial build everything is cached in your nix store.If you want the actual binary, simply replace `run` by `build`.
This flake also contains a dev shell suitable for working on the app:
```shell
nix develop github:buntec/minimal-scala-native-http4s-server-app --refresh
```## Notes
The `--refresh` flag above ensures that you always get the most recent commit.