logging-service
v1.0.1
Published
Service that listens for messages over HTTP and logs them to console
Downloads
1,231
Maintainers
Readme
Installation
$ npm install logging-service
How It Works
- Listens for HTTP GET/POST messages to http://localhost:3000/log
- GET messages --> send properties 'type' and 'message' as query parameters
- POST messages --> send properties 'type' and 'message' as JSON object
- Supported values for type: log, error, warn, info (each gives different colour message, defaults to log if none provided or invalid type)
Running The Service
In the command line cd to the logging-service directory and execute
$ node index.js
Any messages sent to the service should now be output to the console
Examples
Making GET request with AngularJS
var type = "error";
var message = "Error loading file!";
$http.get("http://localhost:3000/log?type=" + type + "&message=" + message);
Making POST request with AngularJS
$http.post("http://localhost:3000/log", {
type: "log",
message: escape("Loading http://test.com/a=b&c=d"));
}