RuntimeTools / appmetrics-dash

A data visualizer that uses " Node Application Metrics" (appmetrics) to monitor and display Node.js application data as a html web application.
Other
456 stars 55 forks source link

adds option to pass middleware #150

Closed vajahath closed 6 years ago

vajahath commented 6 years ago

This PR enable users to pass a middleware along with options object.

If I want to protect the appmetrics dash, pass a middleware like:

const options = {
  ...
  middleware: (req, res, next)=>{
    // do stuff to protect
    return next()
  }
  ...
}

attach(options);
codecov-io commented 6 years ago

Codecov Report

Merging #150 into master will increase coverage by 2.37%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #150      +/-   ##
==========================================
+ Coverage   63.17%   65.54%   +2.37%     
==========================================
  Files           4        4              
  Lines         410      415       +5     
==========================================
+ Hits          259      272      +13     
+ Misses        151      143       -8
Impacted Files Coverage Δ
lib/appmetrics-dash.js 62.66% <100%> (+3.68%) :arrow_up:
lib/classes/collections.js 64% <0%> (-2%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a8c44ee...72c0b2a. Read the comment docs.

tobespc commented 6 years ago

Hi @vajahath before we can accept this, please can you read https://github.com/RuntimeTools/appmetrics-dash/blob/master/CONTRIBUTING.md and add your name to the authors file .

Can you also provide an example of a testcase using this function.

Thanks, Toby

vajahath commented 6 years ago

@tobespc done a few things. please verify :)

tobespc commented 6 years ago

looks good, I'll run some tests and then accept it

vajahath commented 6 years ago

@tobespc when can I expect the push to npm ?

tobespc commented 6 years ago

Just need to work through a few internal release checks first but I would hope it goes today

tobespc commented 6 years ago

@vajahath appmetrics-dash 4.0.0 is now on npm with your change in. Thanks for the work you did on this