Mojito and npm Packaging¶
Having installed Mojito with npm 1.0, you already understand that Mojito is an npm package. What may not be as clear is that Mojito applications are also npm packages. Being an npm package, Mojito applications can have their own dependencies that are installed using npm. For example, after you create a Mojito application, you can use npm to install a local copy of the Mojito framework in the node_modules directory. If you deployed your application to a cloud server that has a Node.js runtime environment, your application could be run by this locally installed copy of the Mojito framework.
Your Mojito application can also install other npm modules, even those that contain Mojito resources, such as mojits or middleware. Conversely, you can create npm modules that contain Mojito resources, so other developers can reuse your code.
Because npm allows you to use other modules or create your own, this chapter is divided into two sections to meet the needs of the following two audiences:
A Mojito resource is a piece of code or functionality used by Mojito. These resources can be installed with npm or live directly in the Mojito application. Examples of Mojito resources could be shared mojits and middleware. Developers using shared mojits and those authoring npm modules that contain code used by Mojito should be familiar with the meaning of Mojito resource as it will be used throughout this chapter.