O'Reilly logo

JavaScript Everywhere by Adam D. Scott

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. CRUD Operations

The first time I heard the term CRUD Application, I wrongfully assumed that it referred to an application that did something dirty or tricky. Admittedly, “CRUD” sounds as if it refers to something that would be scraped off the bottom of a shoe. In fact, the term CRUD was first popularized in the early 1980’s by the British technology author, James Martin, in reference to applications that Create, Read, Update, and Delete data. Though this term has been around for well over a quarter of a century, it still applies to many applications developed today. Consider the applications that you interact with daily — these may include todo lists, spreadsheets, content management systems, text editors, social media websites, and several others — chances are, that many of them fall into the CRUD application format. A user creates some data, a user accesses or reads data, a user may update or delete that data.

Our Notedly application will follow the CRUD pattern. Users will be able to create, read, updated, and delete their own notes. In this chapter, we’ll implement the essential CRUD functionality of our API by connecting our resolvers and database.

Separating Our GraphQL Schema and Resolvers

Currently our src/index.js file is home to our Express/Apollo server code as well as our API’s schema and resolvers. As you can imagine, this could get a bit unwieldy as our codebase grows. Before this happens, let’s take some time to do a minor refactor that separates our ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required