ExpressWorks will provide you with tasks and hints. You write the solutions to these problems. Then, after you wrote a solution as an Express.js app, ExpressWorks will verify your solution to the problem.

Local Installation (Advanced)

Optional step that gives you the global command (expressworks) in the Terminal/command prompt:

$ npm link
$ expressworks

Usage

$ expressworks

Note: ExpressWorks depends on a local copy of Express being available in your project folder. To do the exercises, make sure to install the Express.js with

$ npm init
$ npm install express@4.11.2

See Offline Setup for more required dependencies.

ExpressWorks understands these commands:

Usage
expressworks
Show a menu to interactively select a workshop.
expressworks list
Show a newline-separated list of all the workshops.
expressworks select NAME
Select a workshop.
expressworks current
Show the currently selected workshop.
expressworks run program.js
Run your program against the selected input.
expressworks verify program.js
Verify your program against the expected output.

Offline Setup

If you would like to setup all node packages beforehand, you can complete this workshop offline. Here are all the modules to install with exact versions that this workshop supports:

$ npm install express@4.11.2

$ npm install pug@2.0.0-beta6

$ npm install body-parser@1.12.0

$ npm install stylus@0.50.0

Note: You need to have node_modules or packagen.json in your project folder before installing dependencies. Run $ mkdir node_modules or $ npm init to create one of them.

Reset

If you want to reset the list of completed tasks, clean the ~/.config/expressworks/completed.json file.

Good Old Form

Static

Apply static middleware to server index.html file without any routes. The index.html file is provided and usable via process.argv[3] value of the path to it. However, you can use your own file with this content:

<html>

<head>

<linkrel="stylesheet"type="text/css"href="/main.css"/>

</head>

<body>

<p>I am red!</p>

</body>

</html>

Stylish CSS

Style your HTML from previous example with some Stylus middleware. The path to main.styl file is provided in process.argv[3] or you can create your own file/folder from these: