Utilities
Here will be listed some utilities created to be used inside your RhapsodyJS app.
Logging
For use the logging system (configured in the file of your current environment in app/config/environment_name.js
), you just use:
Rhapsody.log.LOG_LEVEL(TITLE, MESSAGE);
For the API of Rhapsody.log
, see the WolverineJS API.
Libs
All libs used internally by RhapsodyJS that you possibly would use in your app are accessible trough the Rhapsody
global variable, they are:
Rhapsody.libs.express
https://www.npmjs.org/package/expressRhapsody.libs.jsmin
https://www.npmjs.org/package/jsminRhapsody.libs.lodash
https://www.npmjs.org/package/lodashRhapsody.libs.wolverine
https://www.npmjs.org/package/wolverine
Middlewares
When you're configuring the middlewares of a controller or a view, you can set any of then as the name of a file inside the app/middlewares
folder (without the .js
) or the function itself.
The NodeJS community has already created some standard middlewares, and some of them can be accessed by the Rhapsody
global variable, they are:
Rhapsody.middlewares.compression
https://www.npmjs.org/package/compressionRhapsody.middlewares.methodOverride
https://www.npmjs.org/package/method-overrideRhapsody.middlewares.bodyParser
https://www.npmjs.org/package/body-parserRhapsody.middlewares.multiparty
https://www.npmjs.org/package/connect-multipartyRhapsody.middlewares.cookieParser
https://www.npmjs.org/package/cookie-parserRhapsody.middlewares.session
https://www.npmjs.org/package/express-sessionRhapsody.middlewares.csurf
https://www.npmjs.org/package/csurfRhapsody.middlewares.cors
https://www.npmjs.org/package/corsRhapsody.middlewares.ajaxOnly
https://www.npmjs.org/package/ajax-onlyRhapsody.middlewares.secureOnly
https://www.npmjs.org/package/secure-only
Root folder of the app
The app root folder (that contains the app
, node_modules
, app.js
and package.json
) can be accessed by the variable Rhapsody.root
.
Express app
The Express app of your project can be accessed in Rhapsody.app
.