Skip to content

Instrumental/node-js-sample

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instrumental Express Demo Application

This is a demo app showing how to use Instrumental in an Express app. Below you'll see some basic directions and then the original Express Demo README. Feel free to browse the changes we've made to see just how easy it is.

Add the Instrumental Agent to package.json.

{
  "dependencies": {
    "instrumental-node": "^1.x"
  },
}

Run the installation:

npm install

Add the Instrumental Agent and configuration to your app:

var I = require('instrumental-node');
I.configure({
  // from here: https://instrumentalapp.com/docs/tokens
  apiKey:  process.env.INSTRUMENTAL_API_KEY, // 'project_api_token',

  // optional, default shown
  host:    'collector.instrumentalapp.com',

  // optional, default shown
  enabled: true,
});

You can use the enabled to enable or disable the agent in different environments.

Now add instrumentation to your app wherever you'd like more info. For instance, if your users can create blog posts, perhaps you'll instrument blog post creation like so:

I.increment("blog_post.create");

node-js-sample

A barebones Node.js app using Express 4.

Running Locally

Make sure you have Node.js and the Heroku Toolbelt installed.

git clone git@github.com:heroku/node-js-sample.git # or clone your own fork
cd node-js-sample
npm install
npm start

Your app should now be running on localhost:5000.

Deploying to Heroku

heroku create
git push heroku master
heroku open

Alternatively, you can deploy your own copy of the app using the web-based flow:

Deploy to Heroku

Documentation

For more information about using Node.js on Heroku, see these Dev Center articles:

About

A barebones Node.js app using the Express framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%