Skip to content

Commit d22d562

Browse files
authored
Updated no-conflict and universal-node examples READMEs (#1253)
1 parent c93d44c commit d22d562

File tree

3 files changed

+88
-10
lines changed

3 files changed

+88
-10
lines changed

examples/angular/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ng serve
2020

2121
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
2222

23-
Now, you can test the Rollbar integration by clicking the buttons "Throw an Error" and "Log a Warning". You
23+
Now, you can test the Rollbar integration by clicking the buttons "Throw an Error" and "Log a Warning". You
2424

2525
## Development server - server-side
2626

@@ -42,4 +42,4 @@ Now, you can test the Rollbar integration by navigating to the url `http://local
4242

4343
## Additional Resources
4444

45-
Need help? Rollbar Support can be reached via email at [email protected]
45+
Need help? Rollbar Support can be reached via email at [email protected]

examples/no-conflict/README.md

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
1-
- npm install
2-
- npm start
1+
# No-Conflict Mode Example
32

4-
This only uses a server to get around CORS for loading the rollbar library from a local file via the
5-
snippet.
3+
This example demonstrates how to use Rollbar's no-conflict mode, which allows multiple instances of Rollbar to coexist on the same page without interfering with each other.
4+
5+
## Use Case
6+
7+
Perfect for:
8+
- Third-party libraries that include Rollbar internally
9+
- Widgets or embedded tools that need their own error tracking
10+
- Avoiding conflicts when multiple teams use Rollbar on the same page
11+
12+
## Setup
13+
14+
```bash
15+
npm install
16+
npm run build
17+
npm start
18+
```
19+
20+
## How It Works
21+
22+
1. **Main Page** (`test.html`): Uses the standard Rollbar snippet to track errors
23+
2. **Tool Library** (`tool.js`): Uses `rollbar.noconflict.umd` to create an isolated instance
24+
3. **Webpack Build**: Bundles the tool with its own Rollbar instance that won't conflict with the page's instance
25+
26+
## Key Features
27+
28+
- Multiple Rollbar instances can run simultaneously
29+
- Each instance maintains its own configuration and access token
30+
- No global namespace pollution
31+
- Ideal for library authors who want to include Rollbar without affecting the host page
32+
33+
## Testing
34+
35+
After starting the server, visit http://localhost:3000 and:
36+
- Click "Foo" to trigger an error tracked by the main page's Rollbar
37+
- Click "Tool" to execute code that uses the embedded library's Rollbar

examples/universal-node/README.md

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,51 @@
1-
- npm install
2-
- npm run build
3-
- npm run start
1+
# Universal Node.js Example
42

5-
This uses the local version of rollbar in this repository.
3+
This example demonstrates Rollbar.js in a universal (isomorphic) JavaScript application with both server-side and client-side error tracking.
4+
5+
## Overview
6+
7+
A full-stack example featuring:
8+
- **Server**: Express.js with server-side rendering
9+
- **Client**: React application with webpack bundling
10+
- **Universal**: Same error tracking on both server and client
11+
12+
## Setup
13+
14+
```bash
15+
npm install
16+
npm run build
17+
npm start
18+
```
19+
20+
## Features
21+
22+
### Server-Side Error Tracking
23+
- Catches unhandled exceptions in Express routes
24+
- Tracks errors with request context (user ID, headers, etc.)
25+
- Demonstrates both error throwing and manual logging
26+
27+
### Client-Side Error Tracking
28+
- React error boundaries integration
29+
- Captures browser errors and user interactions
30+
- Shares configuration between server and client builds
31+
32+
## Routes
33+
34+
- `/` - Main React application
35+
- `/error` - Triggers a server-side error (demonstrates Express error handling)
36+
- `/dolog` - Demonstrates manual server-side logging
37+
- Click "bar" button - Triggers a client-side error
38+
39+
## How It Works
40+
41+
1. **Server** (`server.js`): Initializes Rollbar for Node.js, handles Express errors
42+
2. **Client** (`app/App.js`): React app that triggers client-side errors
43+
3. **Webpack**: Bundles client code with Rollbar browser SDK included
44+
4. **Hot Reload**: Development mode includes webpack hot middleware
45+
46+
## Testing
47+
48+
Visit http://localhost:3000 and:
49+
- Click the "bar" button to trigger a client-side error
50+
- Click "Backend error" link to trigger a server-side error
51+
- Check your Rollbar dashboard to see both errors tracked

0 commit comments

Comments
 (0)