Avoid Invalid Requests to Your Express.js Server Using celebrate

1 · · Oct. 18, 2019, 6:22 p.m.
Summary
In this article, we’ll build a REST API with Node.js and Express and protect one endpoint from arbitrary requests. At first, we will develop an unsecured API, then we will add a own validation and analyze the shortcomings of it, finally we’ll use celebrate, a joi middleware for Express, to implement a completely flexible solution. Prerequisites Node.js Express REST Concepts cURL Getting Started In order to bring to life our API, we need to setup our new project: $ mkdir swamp-api $ cd swamp-ap...