Giter Club home page Giter Club logo

node-for-jasper's Introduction

Samples

These samples offer potential solutions to some common pain points you might have run into.

All examples were tested against node 0.12, but should work on pretty much any version.

1-mocks

1-mocks illustrates how to use proxyquire to mock module dependencies in unit tests. The example writes tests around the attack function in player.js, which has a dependency on die.js to determine whether or not to crit.

To run the example:

cd 1-mocks
npm install
npm run test

2-debug

2-debug illustrates how to use node-inspector to attach the Chrome Developer tools to your running server process by navigating to a link. Once open, the developer tools will allow you to set breakpoints on a method that intermittently fails.

To run the example:

cd 2-debug
npm install
npm run start-debug

Example output:

[gisenberg@mbp15:~/git/node-for-jasper/2-debug (master)]$ npm run start-debug

> [email protected] start-debug /Users/gisenberg/git/node-for-jasper/2-debug
> node-debug src/server.js

Node Inspector is now available from http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858
Debugging `src/server.js`

Debugger listening on port 5858

3-log-to-elastic

3-log-to-elastic hosts a REST endpoint that is instrumented to log error and informational messages to a remote elasticsearch instance.

To run the example:

cd 3-log-to-elastic
npm install
npm run start

Afterwards, navigate to http://localhost:8080/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.