0.1.5 • Published 6 months ago
insightify v0.1.5
A metrics and analytics library for Express js. Can be configured as a middleware.
const insights = require('insightify')
const express = require('express')
const app = express()
// provide config
insights.config({
title: "Title",
author: "Author",
createdDate: Date.now(),
fetchStrategy: 'local', // local / api
})
// add middleware
app.use(insights.duration);
app.get('/', function (req, res) {
res.send('Hello World')
})
// generates insights preview
app.get('/insights-page', (req, res, next) => {
return insights.insightsPage(req, res, next);
})
// get last week hits (API endpoint)
app.get('/last-week-hits', (req, res, next) => {
return insights.previousWeekHits(req, res, next);
})
app.listen(3000)
Installation
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js. Node.js 0.10 or higher is required.
Installation is done using the
npm install
command:
$ npm install insightify