Skip to content
This repository was archived by the owner on Jul 4, 2024. It is now read-only.
This repository was archived by the owner on Jul 4, 2024. It is now read-only.

NewApi undefined #2

@flowpig

Description

@flowpig

there is an error "undefined: api.NewApi" when i use api.NewApi, can you give me some guidance. Here's my code snippet:

import (
        ...
	"go-micro.dev/v4"
	"go-micro.dev/v4/api"
	"go-micro.dev/v4/api/router"
	"go-micro.dev/v4/api/router/registry"
)

	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	r := router.WithRegistry(etcd.NewRegistry(rst.Addrs("127.0.0.1:2379")))
	api := api.NewApi(api.WithRouter(registry.NewRouter(r)))

	if err := api.Run(ctx); err != nil {
		log.Fatal(err)
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions