50 lines
1.4 KiB
Markdown
50 lines
1.4 KiB
Markdown
# 3Dverse test task
|
|
|
|
## Solution
|
|
|
|
### Technology choosen
|
|
|
|
1. [deno](https://deno.com/) instead of nodejs as platform.
|
|
2. [deno kv](https://deno.com/kv) for database.
|
|
3. [nix](https://nixos.org/) flake as build system
|
|
|
|
|
|
### Development environment
|
|
If the developper has nix flake installed. `nix develop` will install
|
|
all the system dependencies. Otherwise, `deno` is required; hey,
|
|
and psrecord are two useful tool to benchmark the server.
|
|
|
|
### Running the tests.
|
|
|
|
The best way to build the test is to run `nix build .#test` which
|
|
will output a report in `./result`. Otherwise,
|
|
`deno test --unstable --allow-read=tests tests` should run all the tests.
|
|
|
|
|
|
### Running the project.
|
|
|
|
|
|
The main file to run the server is `src/server.ts`. To command line
|
|
`deno run --unstable --allow-net src/server.ts` will run the server locally.
|
|
One can add the flag `--v8-flags=--max-heap-size=50` to limit the
|
|
allowed memory to, in this example, 50mb.
|
|
|
|
|
|
In a similar fashion, it is possible to run the application without
|
|
checking out the code using the command line
|
|
|
|
```shell
|
|
deno run --v8-flags=--max-heap-size=50 --unstable --allow-net https://gitlab.com/didiercrunch/3dverse-testtask/-/raw/master/src/server.ts
|
|
```
|
|
|
|
## Architecture
|
|
|
|
|
|
```mermaid
|
|
sequenceDiagram
|
|
title: Persist file
|
|
client->>RestAPI: HTTP request
|
|
RestAPI->>FileService: Persist file metadata
|
|
FileService->>BlobService: Persist file
|
|
```
|