How to deploy nodejs & express to parse.com?

express, node.js, parse-cloud-code, parse-platform

Solution

On Parse Could you can only use those few node modules that are already pre-installed, like expressjs with jade templating, some express middlewares and few other ones. There is no `npm install` step that would install dependencies from your `package.json`. That's why you've got the error about missing `morgan` module.

Problem

I've developed a web app on nodejs with express as framework and jade as templating engine with the aim to deploy it to parse.com. Everything worked great locally, but now I would like to deploy the current release. But the parse command line tool isn't working as expected (e.g. can't find modules) and I couldn't find a tutorial, how and what to deploy (especially to parse). I've used parse before as BaaS but not as a nodejs hosting service. Where and how do I have to deploy following folders? - app.js - bin - main.js - node_modules - package.json - public - routes - views Is parse able to download the node_modules if I just upload the package.json? And do I have to configure something on parse.com? One error I always get if I want to deploy the app is following: ``` Update failed with Could not load triggers. The error was Error: Module morgan.js not found at app.js:4:14 at main.js:1:1 ``` I use 'morgan' in my app.js: ``` var express = require('express'); var path = require('path'); //var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); ``` And it is declared in the package.json: ``` { "name": "MyApp", "version": "0.0.0", "private": true, "scripts": { "start": "node ./bin/www" }, "dependencies": { "asyncawait": "0.7.4", "bluebird": "2.3.11", "express": "4.9.0", "body-parser": "1.8.1", "cookie-parser": "1.3.3", "morgan": "1.3.0", "serve-favicon": "2.1.3", "debug": "2.0.0", "jade": "1.6.0" } ```

Original source