mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-20 14:35:07 +00:00
Add Contact API (#340)
* feat: add basic files of contact * chore: code review 1. delete redundant suffix 2. use tab replace whitespace in pb file * chore: add some comments and check post data validation * chore: add some comments * chore: add publicapi.json and examples.json * chore: update README.md * fix: code review conversations
This commit is contained in:
30
contact/main.go
Normal file
30
contact/main.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/micro/micro/v3/service/store"
|
||||
|
||||
"github.com/micro/services/contact/domain"
|
||||
"github.com/micro/services/contact/handler"
|
||||
pb "github.com/micro/services/contact/proto"
|
||||
|
||||
"github.com/micro/micro/v3/service"
|
||||
"github.com/micro/micro/v3/service/logger"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create service
|
||||
srv := service.New(
|
||||
service.Name("contact"),
|
||||
service.Version("latest"),
|
||||
)
|
||||
|
||||
contactDomain := domain.NewContactDomain(store.DefaultStore)
|
||||
|
||||
// Register handler
|
||||
pb.RegisterContactHandler(srv.Server(), handler.NewContact(contactDomain))
|
||||
|
||||
// Run service
|
||||
if err := srv.Run(); err != nil {
|
||||
logger.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user