July 2017
Intermediate to advanced
656 pages
16h 1m
English
A lot of the time in development we want as much context as we can get, but we don't want to have to type out a long flag every time we run a process.
But in production, we want to save precious resources.
Let's copy the app folder to infinite-stack-in-dev-app:
$ cp -fr app infinite-stack-in-dev-app
Now at very the top of index.js, we simply write the following:
if (process.env.NODE_ENV !== 'production') {
Error.stackTraceLimit = Infinity
}
Now if we run our server:
$ node index.js
Then, make a request with curl (or, optionally, some other method, such as a browser):
$ curl http://localhost:3000/
Our stack trace will be limitless.