Skip to content

Commit

Permalink
docs: format code and add identifiers
Browse files Browse the repository at this point in the history
We don't have `pug`/`jade` as an identifier option yet, but I put it there for if it's added in the future.
  • Loading branch information
brnhensley committed Jun 13, 2022
1 parent 46b314e commit 5696bf3
Showing 1 changed file with 17 additions and 18 deletions.
Expand Up @@ -43,7 +43,7 @@ Here are some examples of how to set up browser monitoring with different framew

In your `app.js`:

```
```js
var newrelic = require('newrelic');
var app = require('express')();
// in express, this lets you call newrelic from within a template
Expand All @@ -55,9 +55,9 @@ Here are some examples of how to set up browser monitoring with different framew
app.listen(process.env.PORT);
```

In your **layout.jade**:
In your `layout.jade`:

```
```jade
doctype html
html
head
Expand All @@ -77,7 +77,7 @@ Here are some examples of how to set up browser monitoring with different framew

In your `app.js`:

```
```js
var newrelic = require('newrelic');

var http = require('http')
Expand All @@ -94,15 +94,15 @@ Here are some examples of how to set up browser monitoring with different framew
app.set('views', __dirname + '/views');

app.get('/user/:id', function (req, res) {
res.render('user');
res.render('user');
});

app.listen(process.env.PORT);
```

In your `views/user.html`:

```
```html
<!DOCTYPE html>
<html>
<head>
Expand All @@ -124,39 +124,38 @@ Here are some examples of how to set up browser monitoring with different framew

Using **hapi**, in your `app.js`:

```
```js
var newrelic = require('newrelic');
var Hapi = require('hapi');
var server = new Hapi.Server(parseInt(PORT), '0.0.0.0', {
views: {
views: {
engines : {html: 'handlebars' },
path : __dirname + '/templates'
}
}
});

function homepage(request, reply) {
var context = {
var context = {
// pass in the header each request
nreum : newrelic.getBrowserTimingHeader(),
content : ...
};
};

reply.view('homepage', context);
reply.view('homepage', context);
};

server.route({
method : 'GET',
path : '/',
handler : homepage
method : 'GET',
path : '/',
handler : homepage
});

server.start();
```

In your `templates/homepage.html`:

```
```html
<!DOCTYPE html>
<html>
<head>
Expand All @@ -175,7 +174,7 @@ Here are some examples of how to set up browser monitoring with different framew

By default, calls to `newrelic.getBrowserTimingHeader()` should return valid headers. To disable header generation without removing your template code: In your `newrelic.js` file, add:

```
```js
browser_monitoring : {
enable : false
}
Expand Down

0 comments on commit 5696bf3

Please sign in to comment.