template-go-gin

command module
v0.0.0-...-d475bae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 1 Imported by: 0

README

Go/Gin with MySQL template for Crafting Sandbox

This is a Go/Gin with MySQL template, configured for quick development setup in Crafting Sandbox.

Specifications

main.go specifies the port this package runs on, which matches the port set in App configuration:

func main() {
	// ...
    
	ctx.Port = "3000"

	// ...
}

This template exposes a single /ping route:

var routes = Routes{
	Route{http.MethodGet, "/ping", Ping},
}

This path accepts a query string, and responds with the query string and current time. For example:

$ curl --request GET 'localhost:3000/ping?ping=hello'
{"ping":"hello","received_at":"XXXX-XX-XX XX:XX:XX.XXXXXXXXX +0000 UTC"}

App Definition

The following App Definition was used to create this template:

endpoints:
- name: api
  http:
    routes:
    - pathPrefix: "/"
      backend:
        target: go-gin
        port: api
    authProxy:
      disabled: true
workspaces:
- name: go-gin
  description: Template backend using Go/Gin
  ports:
  - name: api
    port: 3000
    protocol: HTTP/TCP
  checkouts:
  - path: backend
    repo:
      git: https://github.com/crafting-dev/template-go-gin
  packages:
  - name: golang
    version: 1.17.2
dependencies:
- name: mysql
  serviceType: mysql
  version: '8'
  properties:
    database: superhero
    password: batman
    username: brucewayne

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
api
Package api is a template API for Crafting Sandbox.
Package api is a template API for Crafting Sandbox.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL