...

/

Graceful Server—Prestart

Graceful Server—Prestart

Learn how to implement the prestart life cycle method and discover its interesting uses.

What is prestart?

What does a developer typically do before starting a server? Well, think of this as the setup phase—all the dependencies a server needs before deciding that we are fully equipped to start and serve requests. A preflight check might serve as an excellent metaphor. Some typical steps taken in this phase include the following:

Setting up middleware

The term middleware is used to denote the functions called before/after the handler functions. They perform standard operations that might be required across many, if not all, of our routes and handlers. Some examples include authenticating incoming traffic, checking/adding headers, compressing the API responses, etc. These are all common aspects of web services, and they’ll likely be a pain in the neck if not ...