This is an extremely simple example of how you have 'persistent state' when writing an application in Node.js. The
i variable is shared across all requests, so every time the
/increment route is accessed, the number is incremented and returned.
This may seem obvious, but it works quite differently from eg. PHP, where each HTTP request is effectively a 'clean slate', and you don't have persistent state. Were this written in PHP, then every request would have returned
1, rather than an incrementing number.