Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jubaerhossain/golang-starter-fiber
https://github.com/jubaerhossain/golang-starter-fiber
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jubaerhossain/golang-starter-fiber
- Owner: JubaerHossain
- License: mit
- Created: 2023-08-13T05:02:18.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-09-03T12:32:10.000Z (over 1 year ago)
- Last Synced: 2023-09-04T09:47:52.114Z (over 1 year ago)
- Language: Go
- Size: 59.6 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Golang Starter Fiber
## Table of Contents
- [Project Structure](#project-structure)
- [Setup](#setup)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)## Project Structure
The project follows a modular structure for better organization. Here's a breakdown of the main components:
- **app**: Contains the application logic and main entry point.
- **controllers**: Handles HTTP requests, business logic, and response formatting.
- **database**: Manages database connections and interactions.
- **models**: Defines data structures and entities used in the application.
- **repository**: Provides an abstraction for database operations.
- **routes**: Defines API endpoints and connects them to controller methods.
- **services**: Implements the core business logic and interacts with repositories.
- **utils**: Contains utility functions and shared components.
- **main.go**: The application's entry point.1. Clone the repository:
```bash
git clone https://github.com/JubaerHossain/golang-starter-fiber.git
cd golang-starter-fiber
```2. Install dependencies:
```bash
go mod tidy
```3. Create a `.env` file in the root directory and add the following environment variables:
```bash
# Database
MONGOURI=mongodb://localhost:27017
PORT=3000
APP_URL=http://localhost
DB_NAME=hrm
```4. Start the server:
```bash
go run main.go
```### API Endpoints
| Endpoint | Method | Description |
| --------------------- | ------ | ----------------------------------- |
| /api/users | GET | Get all users |
| /api/users | POST | Create a new user |
| /api/users/:id | GET | Get a user by ID |
| /api/users/:id | PUT | Update a user by ID |
| /api/users/:id | DELETE | Delete a user by ID |## Build the Docker image:
```bash
docker build -t golang-starter-fiber .
```## Run the Docker container:
```bash
docker run -p 3000:3000 golang-starter-fiber
```### API Documentation
The API documentation is available at [http://localhost:3000/api-docs](http://localhost:3000/api-docs).
Contributions are welcome! Please refer to the [contributing guide](CONTRIBUTING.md) for more details.
This project is licensed under the [MIT License](LICENSE).