Last night I wrote my very first Nodejs program, server (they wouldn't let me call it program for buzzword sake) on port 8080 walking to the restroom on a 16gigabyte ROM, 1 thousand megabyte RAM inside the 9th version of the Android distro within the Termux CLI, ladies and gentlemen, ItelA56.
It does a pretty neat job. Last night was the first time I had any experience with backend, I must say the logic in it is fine, very fine. Prior to this, I had always dwelled on the frontend of the Web and only done anything Terminal related on a desktop OS and lightweight android compilers for other programming languages.
All these wouldn't had made sense to me if I read this to myself yesterday but it all makes sense now. Backend logic.
Today I learned about "Node Modules" and what they are, they are like JavaScript libraries (like the Math library with Objects and methods, like the react library used within the head of an html file) which can be imported and exported using a method, require() to call it.
Quick check: While searching for definition of a JS library even though I "knew" it I saw a blog post of skillcrush on the Google results display say: "JavaScript libraries are like pieces of furniture that add style and function to an already constructed house. Frameworks, on the other hand, are a template you use to build the house itself." And that makes sense in the comparison with the Math library and React library. They add to, so I don't have to "reinvent the wheel".
I also learned that a module is different from the Nodejs file, the node file as I've observed carries the listen method, listen(). Wait I missed one part. There's a module called "http" which is an inbuilt module that allows messages to be sent via HTTP (Hypertext Transfer Protocol) through a server that be included (require(d)) to the main nodejs file in order to be able to create a server, because it contains the createserver() method and listen() method.
To call use a module, the require method is required and storing that required module in a variable to used with methods.
var example = require('http');
//require(d) http module is stored in the variable, example.
Using this information, I created a nodejs file (edited the Hello, World! out) and a module file in the same folder and exported it to the main file using the "exports" keyword in the module code so as to enable it function "outside" within a server code. The module was a JS program to display the current date and time using the date() method.
This is logic and sheer programming, the backend.
This is the closest you can be to machine.
Things learned: Logic, Import, export, modules, Library, Framework, Nodejs, backend, server.
Resource used: W3Schools,
Skillcrush
Node (from the Latin word nodus, meaning to knot, an intersection, an edge, a point, a lump.) is a basic unit of a data structure. In graph theory, a graph is a way to describe many things which have relationships. The things are called nodes, the relationships connecting the nodes are called edges. Connecting edges, points, Node. Nodejs.
Day 1 of Problem solving, backend.
Top comments (0)