36 lines
1.2 KiB
Markdown
36 lines
1.2 KiB
Markdown
# 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.
|