https://github.com/0necontroller/goserver-starter
This is a go template for go projects
https://github.com/0necontroller/goserver-starter
Last synced: 10 months ago
JSON representation
This is a go template for go projects
- Host: GitHub
- URL: https://github.com/0necontroller/goserver-starter
- Owner: 0necontroller
- Created: 2024-05-09T09:45:09.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-21T09:09:47.000Z (about 2 years ago)
- Last Synced: 2025-08-19T14:05:29.371Z (10 months ago)
- Language: Go
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go Server Template
This is a resful API server for this project.
## Project structure
### models
This folder contains the models for the database.
### routes
This folder contains the routes for the API.
### middleware
This folder contains the middleware for the API.
### controllers
This folder contains the controllers for the API.
### database
This folder contains the database connection.
### initializers
This folder contains the initializers for the server.
### utils
This folder contains utility functions.
### app.go
This is the main file for the server.
## Setup
To setup the server, you need to have a `.env` file in the root directory of the project. The `.env` file should contain the following variables:
```
PORT=3000
POSTGRES_URI=postgres://username:password@localhost:5432/dbname
JWT_SECRET=secret-32-characters-long
APP_ENV=dev || prod
```
After setting up the run the following command to setup the go modules:
```
go mod tidy
```
To start the server, run the following command:
```
go run app.go
```