All posts by danmcghan

Creating a REST API: Database Basics

By | Uncategorized | 14 Comments

With the web server in place, it’s time to look into some database basics. As mentioned in the parent post, this series will use the Oracle Database driver/API for Node.js (node-oracledb) to interact with the database. In this post, you’ll create a module that’s responsible for starting up and shutting down a database connection pool. You’ll also add a function that simplifies executing simple statements by getting and releasing connections from the pool automatically.
Read More

Creating a REST API: Web Server Basics

By | Uncategorized | 6 Comments

The web server is one of the most important components of a REST API. In this post, you will start your REST API project by creating some initial directories and files. Then you’ll create a web server module and wire things up so that the web server starts up and shuts down correctly. Finally, you will add some basic logging capabilities to the web server.
Read More

Creating a REST API with Node.js and Oracle Database

By | Uncategorized | No Comments

Node.js and REST APIs go hand in hand. In fact, Ryan Dahl (the creator of Node.js) once described the focus of Node.js as “doing networking correctly”. But where should you start when building a REST API with Node.js? What components should be used and how should things be organized? These are difficult questions to answer – especially when you’re new to the Node.js ecosystem.
Read More

Connecting a Node.js App in ACCS to Exadata Express

By | Uncategorized | No Comments

Two of my favorite Oracle Cloud services are the Exadata Express Cloud Service (Exadata Express) and the Application Container Cloud Service (ACCS). Exadata Express is a fully managed Oracle Database service at an entry-level price point for small to medium sized data and ACCS is an easy way to deploy apps in Docker containers. In this post, I’ll demonstrate how to connect these two services at the most basic level.
Read More

How to get, use, and close a DB connection using async functions

By | Uncategorized | 4 Comments

So far in this async series, we’ve covered Node.js style callbacks, the Async module, and promises. In this final part of the series, we’ll learn about async functions (a.k.a. async/await). To me, async functions are the most exciting thing to happen to JavaScript since Ajax. Finally, we can read JavaScript code in a synchronous manner while it executes asynchronously as it always has.
Read More

How to get, use, and close a DB connection using promises

By | Uncategorized | 6 Comments

The first two patterns we looked at in this series were Node.js callbacks and the Async module. While effective, those patterns are not the only ways of writing asynchronous code. Patterns built around concepts such as “deferreds” and “promises” were first introduced to the JavaScript community via third party libraries like Q and Bluebird. Over time a native implementation of promises was added to ECMAScript, then implemented in V8, and later integrated into Node.js.
Read More

How to get, use, and close a DB connection using the Async module

By | Uncategorized | 2 Comments

The first pattern we looked at in this series was the Node.js callback pattern. As I mentioned there, that pattern alone will only get you so far. Eventually, you’ll want to construct asynchronous workflows that process elements in a collection serially or run several tasks in parallel. You could write your own library, but why reinvent the wheel when you could just use Async, one of the most popular Node.js libraries ever. In this post, we’ll take a look at Async to see how it can help you write asynchronous code in Node.js.
Read More