Skip to content

Rookout/tutorial-nodejs

Repository files navigation

Rookout official tutorial for using Node.JS

CircleCI License Docs GitHub version

This is the official rookout Node.JS tutorial

Prerequisites

  1. Docker - https://www.docker.com/get-docker
  2. Node.JS 10 + NPM

Installation

  1. Clone this repo
git clone https://github.com/Rookout/tutorial-nodejs.git
cd tutorial-nodejs
  1. Set your Rookout token in an ENV variable
export ROOKOUT_TOKEN=YOUR_TOKEN_IN_HERE
  1. Build and run the app
  • Option 1 - Without Docker:
npm start
  • Option 2 - Running with docker
docker run -p 4000:4000 -e ROOKOUT_TOKEN=$ROOKOUT_TOKEN rookout/tutorial-nodejs

Usage

  • Log in to the Rookout IDE
  • Set up your debug session by selecting the NodeJS app you started. See Debug session setup for more information
  • Add the source code according to the following instructions. In this case, use the local filesystem option to associate the code in your local 'tutorial-nodejs' folder.
  • Open the file 'src/services/todos.js'
  • Add a Breakpoint to line 15 by clicking next the the line number in the file viewer
  • The breakpoint should turn solid purple, indicating that it has been set successfully and that it is active.
    • If this is not the case, click here to see how to fix that
  • Go the the app webpage http://localhost:4000/ and add a todo in order to trigger the Breakpoint
  • Check the bottom pane Messages and you'll see the snapshot you just added, as it was triggered by the handler of the web api when you added a todo.

Common Pitfalls

  • Breakpoint status is pending (hollow with purple outline) -- Connection to the app was not able to be established. Make sure that you inserted the Rookout Token in the right place and that the SDK was properly installed.
  • Breakpoint status is disabled (solid grey) -- The breakpoint was disabled from collecting more data due to the limits being hit.
  • Brekapoint error -- something went wrong. Check the breakpoint status to get more information on the error type, and for more information go to our breakpoint status guide.

Want to learn more ?

License

APACHE 2