Comments (8)
I'm not sure what you're implying with "current result". Namespace is not logged. Where it says "Registering node go.micro.api" that is the actual name of the api itself. The API Namespace flag basically affects how the API routes requests. It uses the namespace + path as the service name to route a request to. The default namespace is "go.micro.api" which can be seen here https://github.com/micro/micro/blob/master/api/api.go#L23 but it might be confusing that its also the name of the api itself.
Have you actually tried making requests once the namespace is changed?
from micro.
I understand. Definitely it's a bit misleading.
The actual problem that I throght was involved with the namespace is that the RPC calls were working but not the HTTP ones.
In your example here https://github.com/micro/micro/tree/master/examples/greeter the "Test API via Curl" it always gives me:
curl http://localhost:8080/greeter/say/hello\?name\=John
{"id":"go.micro.client","code":500,"detail":"none available","status":"Internal Server Error"}
I just copy pasted the commands in the example. It works when using the RPC endpoint.
I managed to run some code using the HTTP API but params always arrive emtpy
Form:url.Values(nil), PostForm:url.Values(nil), MultipartForm:(*multipart.Form)(nil)
I have tried POST and GET.
Any ideas?
from micro.
I have a feeling you're running the example incorrectly.
You must run:
- Service Discovery. Default being consul
- The greeter server in examples/greeter/server
- The greeter api in examples/greeter/api
- The micro api
When you curl http://localhost:8080/greeter/say/hello it will send a request to the micro api which makes a request to the greeter api and that queries the greeter server.
I have just started all of these in a terminal and get the response:
$ curl http://localhost:8080/greeter/say/hello?name=John
{"message":"Hello John"}
If using the micro api as a proxy by specifying --api_handler=proxy
then you must use the go-restful api example in examples/greeter/api/go-restful which is then queried as follows:
$ curl http://localhost:8080/greeter/john
{
"msg": "Hello john"
}
It's difficult to know what you're running and in what configuration from that last comment. Also If you changed the API namespace then the names for example application must also be changed from go.micro.api.greeter to whatever your namespace is.
from micro.
Ok, I managed. I deleted all contents and did go get -u
again. The example worked fine.
I also didn't realize that I had to explicitly implement the api
service apart from the service itself to allow HTTP queries. The fact that the RPC service worked without api
using micro api
made me thought that it also worked for HTTP requests.
Maybe it could be a good improvement. Do you think that micro api
could parse the params and build the RPC call by itself without implementing an api
service too?
from micro.
There are a number of reasons for the separation of API services. The primary reason being for architectural design purposes. Please read https://blog.micro.mu/2016/04/18/micro-architecture.html for more info.
from micro.
Thank you for your time, Asim.
from micro.
I was running the greeter/server and greeter/client example. The server starts fine, however, when I start the client as specified, it throws me an error saying {"id":"go.micro.client","code":500,"detail":"none available","status":"Internal Server Error"}
Can you please advice what I might be doing wrong here?
from micro.
Please do not comment in a closed issue. Please join the slack to discuss usage. The error implies the client cannot find the server. Please the readme to clearly understand the setup.
from micro.
Related Issues (20)
- grpc error "transport is closing" HOT 5
- Documentation
- Failed to connect to micro server at 127.0.0.1:10012 HOT 2
- Unable to login on a remote server HOT 2
- How to run in production? HOT 6
- Kubernetes Deployment HOT 2
- Context deadline exceeded HOT 2
- server.NewServer use http2 some bug
- 'micro' is not recognized as an internal or external command, operable program or batch file.
- Problems connecting with Windows
- Could not import opentelemetry HOT 2
- How to write KV to a table. HOT 4
- How to update and delete - tables/databases HOT 1
- Postgres Database Connectivity HOT 2
- micro.dev/v4 - module declares its path as: github.com/micro/micro HOT 8
- Releaser build with CGO_ENABLED=0 doesn't run on Mac M1 HOT 1
- ..\..\go\pkg\mod\github.com\!proton!mail\[email protected]\openpgp\ecdh\x25519.go:16:2: //go:build comment without // +build comment HOT 3
- list of bugs i know
- run micro server command error HOT 6
- go: micro.dev/v4/cmd/protoc-gen-micro@latest: version constraints conflict: HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micro.