restructuring, config and readme

This commit is contained in:
u80864958
2025-04-29 14:57:48 +02:00
parent f027ee7e39
commit fc8b888198
19 changed files with 317 additions and 185 deletions

35
backend/README.md Normal file
View File

@ -0,0 +1,35 @@
# ng-blog Backend
This is the backend service for the ng-blog project. It's written in Go and provides the API endpoints for the frontend application.
## Getting Started
### Prerequisites
- Go (version 1.24 or higher)
### Running the Backend
The backend provides two main commands: `serve` and `help`.
- **`serve`**: Starts the backend server. It loads configuration from environment variables and listens for incoming requests.
```bash
go run ./cmd/main.go serve
```
- **`help`**: Displays usage information about the configuration options.
```bash
go run ./cmd/main.go help
```
### Configuration
The backend is configured using environment variables. The `help` command will display the available configuration options. The configuration is loaded using the `go-simpler.org/env` library. Environment variable names are expected to be in the format `CONFIG_OPTION_NAME`.
## Directory Structure
- `cmd/main.go`: The main entry point for the application. Handles command-line arguments and starts the server.
- `internal/config`: Defines the configuration struct and default values.
- `internal/startup`: Responsible for initializing the HTTP multiplexer and other startup tasks.