new

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

README

micro new [service]

The micro new command is a quick way to generate boilerplate templates for micro services.

Usage

Create a new service by specifying a directory path relative to your $GOPATH

micro new github.com/micro/example

Here it is in action

micro new github.com/micro/example

Creating service go.micro.srv.example in /home/go/src/github.com/micro/example 

.
├── main.go
├── handler
│   └── example.go
├── subscriber
│   └── example.go
├── proto/example
│   └── example.proto
├── Dockerfile
└── README.md


download protobuf for micro:

brew install protobuf
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
go get -u github.com/micro/protoc-gen-micro

compile the proto file example.proto:

cd /home/go/src/github.com/micro/example
protoc --proto_path=. --go_out=. --micro_out=. proto/example/example.proto
Options

Specify more options such as namespace, type, fqdn and alias

micro new --fqdn io.foobar.srv.example github.com/micro/example

Plugins

Specify micro plugins at time of creation.

These must still be flagged on the command line when using the app.

micro new example --plugin=registry=etcd:broker=nats
Help
NAME:
   micro new - Create a new micro service by specifying a directory path relative to your $GOPATH

USAGE:
   micro new [command options] [arguments...]

OPTIONS:
   --namespace "go.micro"			Namespace for the service e.g com.example
   --type "srv"					Type of service e.g api, fnc, srv, web
   --fqdn 					FQDN of service e.g com.example.srv.service (defaults to namespace.type.alias)
   --alias 					Alias is the short name used as part of combined name if specified
   --plugin [--plugin option --plugin option]	Specify plugins e.g --plugin=registry=etcd:broker=nats or use flag multiple times

Documentation

Overview

Package new generates micro service templates

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Commands

func Commands() []cli.Command

Types

This section is empty.

Jump to

Keyboard shortcuts

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