jstash is a user on mastodon.club. You can follow them or interact with them if you have an account anywhere in the fediverse.

@Toxic_Flange I have also done more nodejs/JavaScript than is considered healthy if you're looking for info

@jstash got pointers to decent website or docs to get learning and started quickly?

jstash @jstash

@Toxic_Flange hmm, I'm not to current on the tutorials. What are you trying to build with it? I could probably then apply opinion/experience to a quick search.

For folks just learning JavaScript coming from experience with some other language I always point them at johnresig.com/apps/learn/ to get an understanding of how JS Functions and scopes actually work (that tutorial is a bit stale with ES3 syntax, but modern syntax still "transpiles" with tricks like this)

@jstash learning to use express()/morgan/pug, so I can expand on an existing app. I need to setup a series of fake directory URLS that responds with an HTTP status of 200, and another set that respond with status 300 or behave in the right way, and so on. Trying to figure out a quick n dirty way (arrays? case/switch?) to do that. I'll check that link out.. thanks!

@Toxic_Flange You can set up routes in express with RegExps if you want to get fancy, otherwise, you can loop over an array of paths and just pass in the same callback each time. Trivial to make each path return 200 vs. 3xx.

For example (in ES5 syntax, so modern node.js):

var app = express();
// ... other setup ...
['/foo','/bar'].forEach((path) => {
app.get(path, (req,res) => {
res.status(200).send("..body..");
})
});

@Toxic_Flange The express guide is pretty good at covering all the basics: expressjs.com/en/guide/routing

I don't know anything about morgan or pug, tbqh, but will look around.

@jstash thanks, but no worries man, i think i've eked out enough knowledge to cut n paste and test my scenarios at this point :) the links really helped me a lot!