Hemanth's Scribes

node

Create a NodeSchool Workshop

Author Photo

Hemanth HM

Thumbnail

For international NodeSchool day, here’s how to create a workshop using adventure-runner.

Setup

npm install —save adventure-runner

Structure

  • runner.js - The brain of the workshop
  • problems/ - Where all problems are located
  • package.json - Like any other module

runner.js

var runner = require('adventure-runner');
runner('math-adventure', './problems');

## Problem Definition
javascript
// problems/addition/index.js
exports.problem = 'Write a program that adds two numbers...';

exports.verify = function(args, cb) {
  var proposed = require(process.cwd() + '/' + args[0]);
  if (proposed(3, 4) == 7) {
    console.log("You have solved it!");
    return cb(true);
  }
};
#node#nodeschool
Author Photo

About Hemanth HM

Hemanth HM is a Sr. Machine Learning Manager at PayPal, Google Developer Expert, TC39 delegate, FOSS advocate, and community leader with a passion for programming, AI, and open-source contributions.