The purpose of the module. exports in Node.js is that it encapsulates the total code into a single unit.