DEV Community

darkmage
darkmage

Posted on

A Taste of Node Express

A Taste of Node Express

I am helping a student debug #code in a #node framework I've never even heard of until today #programming #coding #dev #webdev #devcommunity

After having bruteforced my way through Python's Flask, I now have a pretty good gist of what it means to create a REST setup.

Basically, the tl;dr of it is that modern websites do things in the following way:

www.somesite.com/myrest/login
www.somesite.com/myrest/logout
www.somesite.com/myrest/getuserinfo
www.somesite.com/myrest/dostuff
www.somesite.com/myrest/post
www.somesite.com/myrest/etc
Enter fullscreen mode Exit fullscreen mode

Note the very nice structuring here. This is done on purpose for organization. I was totally not used to this growing up. Nobody taught me REST. Nobody taught me how to do anything like this in webdev. I didn't even wanna do webdev originally...

This journey all began around age 11 or 12. Not long after my back surgery, our home got Internet via America Online 3.0. I began making websites shortly after. Before this, a family friend gave me my first machine: an MSDOS Tandy machine. I remember figuring out how to write a simple 4-function calculator in BASIC back then. My websites were written in simple HTML, but even then, I managed to get onto a Final Fantasy 7 webring (lol, the good old days).

Recently, I helped a student find some bugs in a language thingy I barely know anything about, but it turns out that if you know some basic things that you can cross-apply them to areas that you don't know.

This is, in general, how people pick up new things.

node express seems like something similar to Flask, but for node (duh). It is a REST-type system that allows you to construct endpoints in a similar manner. Like Flask, you can test it locally or run it on a server. This makes it super-easy to whip-up custom websites.

A lot of what I see from my student's code looks like this:

app.get('/home', function(req, res) {
    // code here
});

app.post('/login', function(req, res) {
    // code here    
});
Enter fullscreen mode Exit fullscreen mode

It is pretty cool. Javascript is easy (which is why I've never used it lol), but as I am growing up, I am finding that you can do some really cool stuff with it super-easily.

I've always preferred working from a lower-level or backend perspective, but everyone's always trying to pick me up for iOS or webdev frontend roles (ugh!), and for a long time, node.js just seemed too hipster (like Ruby) for me to care about.

After this student, I'm gonna have a sit-down with node.js. In a world of Angulars and Reacts and vues, I'm thinking I'm a node :D


If you need a Computer Science tutor, code reviewer, or just someone to pair program with, hit me up

Top comments (0)