Here’s the code I have so far:
var express = require('express');
var http = require('http');
var app = express();
app.use(require('stylus').middleware(
{ src: __dirname + '/public' }
));
app.post(process.argv[3], function (req, res) {
var value = req.body.str.split('').reverse().join('');
console.log(value);
res.end(value);
});
http.createServer(app).listen(process.argv[2]);
The console.log statement is printing:
ErrorCannot GET /main.css
I think that’s happening because the .styl file isn’t getting translated into a .css file properly. I tried messing with this line:
app.use(require('stylus').middleware(
{ src: __dirname + '/public' }
));
using stuff like process.argv[3] under the assumption that the parameter getting passed in by expressworks is part of the solution but I still kept getting this result. Any help is appreciated, I’ve gotten 4-5 exercises done since my last question but this one has me stumped again.
P.S. I was looking up examples online and they all match the above line so that’s why I wrote it back as that after testing other options.