Lots of fun with Express Server and Node.JS

Mark Pustejovsky
3 min readOct 6, 2020

We are continuing to learn how to use express server and node.js @AustinCodingAcademy. This week we are learning how to authenticate and set up users. We are practicing with Auth0 application to authenticate.

While programming you often end up with errors. What’s the difference between operational and programmer errors? Operation errors are not bugs, but problems with the system, like request timeout or hardware failure. On the other hand programmer errors are actual bugs.

Most of the programming we have been doing is event-driven programming. Which is a programming paradigm in which the flow of the program is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or messages from other programs.

JavaScript is a single threaded. Web workers is an asynchronous system, or protocol, for web pages to execute tasks in the background, independently from the main thread and website UI. It is an isolated environment that is insulated from the window object, the document object, direct internet access and is best suited for long-running or demanding computational tasks.

Apart from web workers — a system dedicated to multithreading — there are other ways to achieve asnychronous processing in JavaScript, such as asynchronous Ajax calls, and event loop.

Node JS can be made scalable due to load balancing. Essentially you can have multiple jobs for node to process and it can handle it with no significant burden. This makes it scalable. All APIs of Node are written is such a way that they supports callbacks.

Using dependencies (or packages developed by others), is very important so that you do not have to re-invent the wheel every-time you build an application. When installing dependencies you can install them globally or locally.

  • Global installation of dependencies is stored in /npm directory. While local installation of dependencies stores in the local mode. Here local mode refers to the package installation in node_modules directory lying in the folder where Node application is present.
  • Globally deployed packages cannot be imported using require() in Node application directly. On the other hand, locally deployed packages are accessible via require().
  • To install a Node project globally -g flag is used.

The last topic for this week is Rest API’s. REST or RESTful API design (Representational State Transfer) is designed to take advantage of existing protocols. While REST can be used over nearly any protocol, it usually takes advantage of HTTP when used for Web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design. REST API Design was defined by Dr. Roy Fielding in his 2000 doctorate dissertation. It is notable for its incredible layer of flexibility. Since data is not tied to methods and resources, REST has the ability to handle multiple types of calls, return different data formats and even change structurally with the correct implementation of hypermedia.

--

--

Mark Pustejovsky

Subject matter expert in P&C and electrical testing. Adding full stack development to resume to bring technology to my next employer.