Socket
Socket
Sign inDemoInstall

sails-hook-apianalytics

Package Overview
Dependencies
24
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.3 to 2.0.0

7

index.js

@@ -27,3 +27,8 @@ /**

routesToLog: [
'/*'
'GET r|^((?![^?]*\\/[^?\\/]+\\.[^?\\/]+(\\?.*)?).)*$|',
// (^^Leave out assets)
'POST /*',
'PATCH /*',
'PUT /*',
'DELETE /*',
],

@@ -30,0 +35,0 @@

2

package.json
{
"name": "sails-hook-apianalytics",
"version": "1.1.3",
"version": "2.0.0",
"description": "Hook for advanced logging of API requests to a Sails.js server.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -25,2 +25,4 @@ # sails-hook-apianalytics

This hook works pretty well for most use cases out of the box.
Optionally, you can customize this hook in a few different ways by configuring `sails.config.apianalytics`.

@@ -40,7 +42,10 @@

*
* (e.g. [ 'get /foo/bar', 'post /foo', 'all /admin/*' ])
* (e.g. [ 'GET /foo/bar', 'POST /foo', 'all /admin/*' ])
*
* Defaults to `[ '/*' ]`.
* Defaults to logging all POST, PATCH, PUT, DELETE requests, and all
* GET requests except for those that appear to be for assets
* (i.e. using "GET r|^((?![^?]*\\/[^?\\/]+\\.[^?\\/]+(\\?.*)?).)*$|")
*/
routesToLog: [
// If you want to log everything- including requests for assets, use the following:
'/*'

@@ -62,40 +67,3 @@ ],

'token'
],
/**
* When request starts...
*
* > If omitted, this defaults to doing nothing.
* > This can be useful for debugging.
*
* @param {Dictionary} report [info about the request]
* @param {Ref} req [request object -- careful not to modify!]
* @param {Ref} res [response object -- careful not to modify! And don't try to respond!]
* @synchronous
*/
onRequest: function onRequest(report, req, res) {
// ...
return;
},
/**
* When response is sent...
*
* > If omitted, this defaults to logging request metadata to the
* > console in a vaguely attractive way. If you define this function,
* > then it will override the default output.
*
* @param {Dictionary} report [info about the request]
* @param {Ref} req [request object -- careful not to modify!]
* @param {Ref} res [response object -- careful not to modify! And don't try to respond!]
* @synchronous
*/
onResponse: function onResponse(report, req, res) {
// ...
return;
}
]
}

@@ -118,3 +86,3 @@ };

Please observe the guidelines and conventions laid out in the [Sails project contribution guide](http://sailsjs.com/contribute) when opening issues or submitting pull requests.
Please observe the guidelines and conventions laid out in the [Sails project contribution guide](http://sailsjs.com/documentation/contributing) when opening issues or submitting pull requests.

@@ -121,0 +89,0 @@ [![NPM info](https://nodei.co/npm/sails-hook-apianalytics.png?downloads=true)](http://npmjs.com/package/sails-hook-apianalytics)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc