This is a sample structure for managing Go projects which provides versioning for REST APIs. This repository has following packages which makes it useful while creating your first GO project.
Basically contains the helper functions used in returning api responses, HTTP status codes, default messages etc.
Contains handler functions for particular route to be called when an api is called.
Contains helper functions used in all apis
Middleware to be used for the project
Database tables to be used as models struct
Resources contains all structures other than models which can be used as responses
Resources define the routes for your project
It is optional, but if you want to insert lots of dummy records in your database, then you can use seeder.
All the core apis for your projects should be within services.
It is generally for storage purpose.
Contains the HTML templates used in your project
Contains environment variables.
. Install latest version of go i.e 1.12 (Released in Feb 2019) . Setup GOROOT and GOPATH
. For running the server you have to run following command
go run main.go
It will start your server at the port you have mentioned in
. If you want to run the server in port other than default, then run following command
go run main.go <specific port>
. If you want to create a build for your project and upload in server, then you have to run following command
CoverFlow is MIT-licensed
We’d be really happy if you sent us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding our work.