First Pit:
In the sidecar component of the Spring-cloud, Write a node.js file, when the use of Sidecar components to register JS to the Eureka, Sidecar service always prompts the Unknow status, after many lookups because the sidecar registration service to the Nodejs status as their own service status identification registered to the Eureka, and no The up is lowercase in the status:up written in Dejs, causing the problem. The up must be capitalized before it takes effect.
Attached Nodejs file as shown:
var http = require (' http ');
var url = require (' URL ');
var path = require (' path ');
Create server
var server = http.createserver (function (req, res) {
//Get the path
var pathname = Url.parse in the request (Req.url ). Pathname;
Res.writehead ({' Content-type ': ' Application/json; Charset=utf-8 '});
Access to http://localhost:8060/will return {"Index": "Welcome to the Home page"}
if (pathname = = =) {
res.end ({"Index": "Welcome to Homepage"});
}
Access to Http://localhost:8060/health will return {"status": "Up"}
else if (pathname = = '/health.json ') {
res.end ( Json.stringify ({"Status": "Up"}); The up must be capitalized before it can take effect
}
//Other case return 404
else {
res.end ("404");
}
);
Create a listener and print the log
server.listen (8060, function () {
console.log (' listening on localhost:8060 ');
};
Second pit: In the Test Spring-cloud config, I built two modules (server and client) in a project that inherited the same parent pom file. When I was set up in the client, the client started without loading the configuration on the server. Reason: I put the server's dependencies
Spring-cloud-config-server
Added to the parent Pom, and client dependencies are added to the Pom file in the client module, which causes the client to start without looking for the server load configuration. The server's dependencies need to be placed in the server's own pom file to avoid impacting client module dependencies.