Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Temporary structure
  • Loading branch information
AxnNxs committed Jun 12, 2023
1 parent 40703f5 commit d77f00a
Showing 1 changed file with 68 additions and 7 deletions.
75 changes: 68 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,77 @@
- This repository is part of MicroAlgae DB project, formed by various modules. Visit the homepage at link https://github.com/BITSapienza for a general guide and automatic installation through docker-compose.

# Description
- Bio-Server is based on Fantastic Coffee platform. Is intended for research and consultation only and contains a
custom structure for a Web and Software Application project. A docker-file is provided to run the backend semi-automatically, avoiding compatibility and installation issues.
- Bio-Server is a backend platform written in Golang and based on Fantastic Coffee platform. Is intended for research and consultation only and contains a custom structure for a Web and Software Application project.

# Requirements
- Despite being a module in its own right, the focus of this backend is to run aside Vulgaris Platform and MongoDB. Please visit homepage for further informations.
- Despite being a module in its own right, the focus of this backend is to run aside Vulgaris Platform and MongoDB. Please visit homepage for further informations. A docker-file is provided to run a standalone backend in semi-automatic mode, avoiding compatibility and installation issues.

# End-Points
---
- link [WIP]

# Database
---
## Project structure
* `cmd/` contains all executables; Go programs here should only do "executable-stuff", like reading options from the CLI/env, etc.
* `cmd/healthcheck` is an example of a daemon for checking the health of servers daemons; useful when the hypervisor is not providing HTTP readiness/liveness probes (e.g., Docker engine)
* `cmd/webapi` contains an example of a web API server daemon
* `demo/` contains a demo config file
* `doc/` contains the documentation (usually, for APIs, this means an OpenAPI file)
* `service/` has all packages for implementing project-specific functionalities
* `service/api` contains an example of an API server
* `service/globaltime` contains a wrapper package for `time.Time` (useful in unit testing)
* `vendor/` is managed by Go, and contains a copy of all dependencies
* `webui/` is an example of a web frontend in Vue.js; it includes:
* Bootstrap JavaScript framework
* a customized version of "Bootstrap dashboard" template
* feather icons as SVG
* Go code for release embedding

# Structures
Other project files include:
* `open-npm.sh` starts a new (temporary) container using `node:lts` image for safe web frontend development (you don't want to use `npm` in your system, do you?)

## Go vendoring
This project uses [Go Vendoring](https://go.dev/ref/mod#vendoring). You must use `go mod vendor` after changing some dependency (`go get` or `go mod tidy`) and add all files under `vendor/` directory in your commit.
For more information about vendoring:
* https://go.dev/ref/mod#vendoring
* https://www.ardanlabs.com/blog/2020/04/modules-06-vendoring.html

## Node/NPM vendoring
This repository contains the `webui/node_modules` directory with all dependencies for Vue.JS. You should commit the content of that directory and both `package.json` and `package-lock.json`.

## How to set up a new project from this template
You need to:
* Change the Go module path to your module path in `go.mod`, `go.sum`, and in `*.go` files around the project
* Rewrite the API documentation `doc/api.yaml`
* If no web frontend is expected, remove `webui` and `cmd/webapi/register-webui.go`
* If no cronjobs or health checks are needed, remove them from `cmd/`
* Update top/package comment inside `cmd/webapi/main.go` to reflect the actual project usage, goal, and general info
* Update the code in `run()` function (`cmd/webapi/main.go`) to connect to databases or external resources
* Write API code inside `service/api`, and create any further package inside `service/` (or subdirectories)

## How to build
If you're not using the WebUI, or if you don't want to embed the WebUI into the final executable, then:
```shell
go build ./cmd/webapi/
```

If you're using the WebUI and you want to embed it into the final executable:
```shell
./open-npm.sh
# (here you're inside the NPM container)
npm run build-embed
exit
# (outside the NPM container)
go build -tags webui ./cmd/webapi/
```

## How to run (in development mode)
You can launch the backend only using:
```shell
go run ./cmd/webapi/
```

If you want to launch the WebUI, open a new tab and launch:
```shell
./open-npm.sh
# (here you're inside the NPM container)
npm run dev
```

0 comments on commit d77f00a

Please sign in to comment.