Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-stats

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-stats

Runtime statics for express production servers

  • 0.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

express-stats

express-stats enables developers to watch their express production servers. These features are supported:

  • see log files, e.g. generated by forever
  • render environment specific Swagger file
  • see memory usage

Getting started

Before you start provide log files in your project folder and make the logs folder writeable (chmod 700 -R logs), e.g.:

  • ./logs/error.log
  • ./logs/console.log

express-stats depends on cors and ejs, so configure your Express app accordingly:

var app = require('express')(),
  cors = require('cors'),
  stats = require('express-stats');

var options = {
  hostname: 'localhost:8080', // default to 'localhost'
  logPath: __dirname + '/logs' // defaults to '/logs',
  swaggerFile: 'swagger.json' //defaults to 'swagger.json'
}

app.use(cors());
app.set('views', './views');
app.engine('json', require('ejs').renderFile);
app.use(stats(options));

app.listen(8080);

Get Swagger file.

Swagger

Your swagger file should contain the variable "host": "<%- hostname %>", that may be generated environment specific. The following Swagger describes the provided endpoints.

swagger: "2.0"
info:
  version: 0.0.1
  title: your application
host: <%- hostname %>
paths:
  /system/logs/{logType}:
    get:
      responses:
        200:
          description: Log file found
      parameters:
        - name: logType
          in: path
          type: string
      tags:
        - system
    delete:
      responses:
        200:
          description: Log file empty
      parameters:
        - name: logType
          in: path
          type: string
      tags:
        - system
  /system/swagger:
    get:
      responses:
        200:
          description: Swagger found
      tags:
        - system
  /system/mem:
    get:
      responses:
        200:
          description: Mem usage reported
      tags:
        - system

LICENSE

MIT License. Copyright 2014-2015 Oceanhouse21 GmbH. http://www.oceanhouse21.com

You are not granted rights or licenses to the trademarks of Oceanhouse21 GmbH.

Keywords

FAQs

Package last updated on 17 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc