https://github.com/ichtrojan/go-package-example
Go Package Example
https://github.com/ichtrojan/go-package-example
docker example go package
Last synced: about 1 year ago
JSON representation
Go Package Example
- Host: GitHub
- URL: https://github.com/ichtrojan/go-package-example
- Owner: ichtrojan
- Created: 2019-08-21T21:58:32.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-04T11:48:54.000Z (over 6 years ago)
- Last Synced: 2023-02-28T13:23:01.958Z (about 3 years ago)
- Topics: docker, example, go, package
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go Custom Package Example
## Introduction
This repo demostrates custom packages in go. The `routes/` directory contains a single go file `api.go` under the package name `routes`. In that file, `mux` router is imported; serving a single route to display `Hello World` declared inside of the `Init` method.
> **NOTE**
> For a package method to be accessed externally, it has to begin with an uppercase
The `main.go` file under package main, imports our custom package and calls the `Init` method in our `routes` package.
## Usage
### Without Docker
* Clone this repo: `git clone https://github.com/ichtrojan/go-package-example.git`
* Change directory: `cd go-package-example`
* Run the application: `go run main.go`
You will be able to access the application from `localhost:9990`
### With Docker
This is the good part, just run:
`docker-compose up`
You will be able to access the application from `localhost:9990`
viola, that all 😀