azat-co / expressworks

Learn Express.js from the author of one of the best books on Express.js—Pro Express.js— with this workshop that will teach you basics of Express.js.
MIT License
709 stars 220 forks source link

Exercise 5 of 8 Fails #101

Closed phemto5 closed 8 years ago

phemto5 commented 8 years ago

I think there has been an update to the modules sine this was released it looks like The Stylus exercise is not working. ` Master Express.js and have fun! ───────────────────────────────── STYLISH CSS Exercise 5 of 8

HTML without styles is boring so this exercise will teach you how to use Stylus with Express on the fly.

Style the HTML from the "STATIC" exercise using Stylus middleware. Stylus https://github.com/stylus/stylus generates .css files on-the-fly from .styl files.

Your solution should listen on the port supplied by process.argv[2] for GET requests, one of which will be for main.css, which should be automatically generated by your Stylus middleware. index.html and main.styl can be found in process.argv[3](they are in the same directory).

You could also create your own folder and use these, if you like:

The main.styl file:

p
  color red

The index.html file:

<html>
  <head>
    <title>expressworks</title>
    <link rel="stylesheet" type="text/css" href="/main.css"/>
  </head>
  <body>
    <p>I am red!</p>
  </body>
</html>

HINTS

You'll want to plug in some stylus middleware using app.use again. It'll look something like this:

app.use(require('stylus').middleware('/path/to/*.styl' ))

In addition to producing in the "STATIC" exercise, you'll need to serve static files. Remember that middleware is executed in the order app.use is called!

NOTE

For your own projects, Stylus needs to be installed like any other dependency:

$ npm install stylus

» To print these instructions again, run: expressworks print » To execute your program in a test environment, run: expressworks run program.js » To verify your program, run: expressworks verify program.js » For help run: expressworks help

$ expressworks run expressworks.js /usr/lib/node_modules/expressworks/exercises/stylish_css/public Cannot GET /main.css $ expressworks help 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 print Print the instructions for the currently selected workshop. expressworks next Print the instructions for the next incomplete workshop after the currently selected workshop. expressworks reset Reset completed workshop progress. expressworks run program.js Run your program against the selected input. expressworks verify program.js Verify your program against the expected output. expressworks -l Change the system to the specified language.

Welcome to ExpressWorks — automated workshop for Express.js framework. Express.js workshop based on workshopper and inspired by stream-adventure by @substack and @maxogden.

API docs:

http://expressjs.com/api.html

Express.js Guide:

http://expressjsguide.com

Issues? Suggestions? Feedback?

https://github.com/azat-co/expressworks/issues

Other awesome workshops: http://nodeschool.io

$ expressworks help 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 print Print the instructions for the currently selected workshop. expressworks next Print the instructions for the next incomplete workshop after the currently selected workshop. expressworks reset Reset completed workshop progress. expressworks run program.js Run your program against the selected input. expressworks verify program.js Verify your program against the expected output. expressworks -l Change the system to the specified language.

Welcome to ExpressWorks — automated workshop for Express.js framework. Express.js workshop based on workshopper and inspired by stream-adventure by @substack and @maxogden.

API docs:

http://expressjs.com/api.html

Express.js Guide:

http://expressjsguide.com

Issues? Suggestions? Feedback?

https://github.com/azat-co/expressworks/issues

Other awesome workshops: http://nodeschool.io

$ expressworks run expressworks.js /usr/lib/node_modules/expressworks/exercises/stylish_css/public Error: EACCES, open '/usr/lib/node_modules/expressworks/exercises/stylish_css/public/main.css' Error: EACCES, open '/usr/lib/node_modules/expressworks/exercises/stylish_css/public/main.css' $ expressworks run expressworks.js /usr/lib/node_modules/expressworks/exercises/stylish_css/public Cannot GET /main.css $ expressworks run expressworks.js Cannot GET /main.css $ expressworks verify expressworks.js

Your submission results compared to the expected:

             ACTUAL                                 EXPECTED                

────────────────────────────────────────────────────────────────────────────────

"Cannot GET /main.css" != "Error: EACCES, open '/usr/lib/node_modules/expressworks/exercises/stylish_css/public/main.css'" "" == ""

────────────────────────────────────────────────────────────────────────────────

✗ Submission results did not match expected!

FAIL

Your solution to STYLISH CSS didn't pass. Try again!

[nanderson@nick-fedora meanstack]$ expressworks verify expressworks.js

Your submission results compared to the expected:

             ACTUAL                                 EXPECTED                

────────────────────────────────────────────────────────────────────────────────

"Error: EACCES, open '/usr/lib/node_modules/expressworks/exercises/stylish_css/public/main.css'" == "Error: EACCES, open '/usr/lib/node_modules/expressworks/exercises/stylish_css/public/main.css'" "" == ""

────────────────────────────────────────────────────────────────────────────────

✓ Submission results match expected

PASS

Your solution to STYLISH CSS passed!

Error: EACCES, open '/usr/lib/node_modules/expressworks/exercises/stylish_css/public/main.css' Here's the official solution in case you want to compare notes:

──────────────────────────────────────────────────────────────────────────────── var express = require('express') var app = express()

app.use(require('stylus').middleware(process.argv[3]));
app.use(express.static(process.argv[3]));

app.listen(process.argv[2])

────────────────────────────────────────────────────────────────────────────────

You have 3 challenges left. Type 'expressworks' to show the menu. `

azat-co commented 8 years ago

this is your error

"Error: EACCES, open '/usr/lib/node_modules/expressworks/exercises/stylish_css/public/main.css'" == "Error: EACCES, open '/usr/lib/node_modules/expressworks/exercises/stylish_css/public/main.css'"
"" == ""