vesys-bank-server/README.md

71 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2022-03-25 18:23:58 +00:00
# vesys bank servers and clients
2022-03-26 10:43:01 +00:00
2022-03-18 18:51:17 +00:00
Implementations of a simple bank server for the 2022 vesys class at FHNW.
2022-03-26 10:43:01 +00:00
Please note that the writer is in no way an experienced or even professional rust developer (hence the cloning
everywhere) and most of this was written in a hurry. Parts of the code might sneak into your house in bright daylight
and marry your cat to run off with them to Greenland or wherever it is they go for their honeymoon.
2022-03-18 18:51:17 +00:00
## socket-server
2022-03-26 10:43:01 +00:00
2022-03-18 18:51:17 +00:00
Use an on-the-fly invented byte protocol. Consult the code for documentation.
## http-server
2022-03-26 10:43:01 +00:00
An http implementation, using [actix-web](https://actix.rs/), wanted to try that for a while now. Again, consult the
code for information on how the routes work.
2022-03-18 18:51:17 +00:00
2022-03-25 18:23:58 +00:00
## http-client
2022-03-26 10:43:01 +00:00
An experimental client for the http-server, built with rust, [yew](https://yew.rs/) and the power of web assembly. First
time I am trying this, there is probably even more wrong with it than with the server implementations.
2022-03-25 18:23:58 +00:00
2022-03-18 18:51:17 +00:00
# Usage
2022-03-26 10:43:01 +00:00
2022-03-25 18:23:58 +00:00
## Servers
2022-03-26 10:43:01 +00:00
2022-03-19 09:02:39 +00:00
Run it like you would with any [cargo workspace](https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html) project.
2022-03-18 18:51:17 +00:00
For example, starting the http-server variant, with debug logging and compiled in release mode:
2022-03-26 10:43:01 +00:00
2022-03-18 18:51:17 +00:00
```
RUST_LOG=debug cargo run --release --bin http-server
```
2022-03-25 18:23:58 +00:00
## http client
2022-03-26 10:43:01 +00:00
2022-03-25 18:23:58 +00:00
[Trunk](https://trunkrs.dev/) is used for wasm bundling.
Local development with auto-reload:
2022-03-26 10:43:01 +00:00
2022-03-25 18:23:58 +00:00
```
trunk serve
```
Build for release (the built artifacts can be found in `dist`):
2022-03-26 10:43:01 +00:00
2022-03-25 18:23:58 +00:00
```
trunk build --release
2022-03-26 10:00:13 +00:00
```
# Releases
2022-03-26 10:43:01 +00:00
2022-03-26 10:00:13 +00:00
Release binaries are built for multiple architectures (always statically compiled):
2022-03-26 10:43:01 +00:00
- x86_64-unknown-linux-musl (needs `x86_64-linux-musl-gcc`)
2022-03-26 10:00:13 +00:00
- aarch64-unknown-linux-musl (needs `aarch64-linux-musl-gcc` and `aarch64-linux-musl-gcc`)
- x86_64-pc-windows-gnu (needs `x86_64-w64-mingw32-gcc`)
2022-03-26 10:28:30 +00:00
- wasm32-unknown-unknown (needed for the http-client)
2022-03-26 10:00:13 +00:00
These are the target triplet names as they are used by rustup (add them with `rustup target add $TARGET`).
To make it more convenient to build, a makefile is provided. Use the following targets for it:
- linux-x86_64-musl
2022-03-26 10:43:01 +00:00
- linux-aarch64-musl
- windows-gnu
2022-03-26 10:00:13 +00:00
- http-client
2022-03-26 10:43:01 +00:00
The `default` and `all` targets build all of them. After a successful build, everything is copied into the `release`
folder.