Welcome, Guest Login

Public Cloud Center

Getting Started with Node.js

Last Updated: Oct 13, 2015 01:34PM EDT

Welcome to Modulus! This guide will walk you through all the necessary steps to deploy a Node.js application on the Modulus platform.

Video

1. Write Something

Modulus Demo App

If you would like to exercise the platform and don’t have an application ready yet, grab the Modulus demo application.

​git clone git://github.com/onmodulus/modulus-demo.git

Setup Your Application

More about application setup can be found in the application guidelines.

  1. Use the environment variable PORT.
    app.listen(process.env.PORT)
  2. Specify your dependencies in the package.json file.
    {
      "name": "my-application",
      "version": "0.0.1",
      "description": "My application description.",
      "main": "app.js",
      "dependencies" : {
        "express" : "2.5.x",
        "ejs" : "0.8.x"
      }
    }
  3. Specify the main file in your package.json.
    {
      "name": "my-application",
      "version": "0.0.1",
      "description": "My application description.",
      "main": "path/to/custom_main.js",
      "dependencies" : {
        "express" : "2.5.x",
        "ejs" : "0.8.x"
      }
    }
  4. Specify the version of Node your application requires.
    {
      "name": "my-application",
      "version": "0.0.1",
      "description": "My application description.",
      "main": "path/to/custom_main.js",
      "dependencies" : {
        "express" : "2.5.x",
        "ejs" : "0.8.x"
      },
      "engines" : {
        "node": "0.10.x"
      }
    }

2. Install the Modulus CLI (optional)

In order to install the Modulus CLI, you must first install Node.js. You can find installers for all majors OS’s at nodejs.org.

Now that node.js is installed you may proceed to install the modulus CLI.  In most cases, the the command line interface (CLI) is going to be a more convenient way to deploy an application. The CLI is optional and every task it can preform can also be performed using the web interface.  

$ npm install -g modulus

3. Log In

If you are using the CLI you will need to log in before you can create or deploy a project. Assuming you have already created an account, logging in through the CLI is easy.

The Modulus CLI stores authentication information locally (as a token, not actual usernames and passwords), so logins are only required once.

$ modulus login
Welcome to Modulus
[?] Enter your username or email: parker@example.com
[?] Enter your password:
[✓] Signed in as user spiderman

If you created an account using GitHub, you can use the --github (-g) option to log in with your GitHub credentials.

Note: Github logins do not work with two-factor authentication enabled.

$ modulus login --github
Welcome to Modulus
[?] Enter your GitHub username or email: pparker
[?] Enter your password:
[✓] Signed in as user spiderman

4. Create Project

A project can be created through the user dashboard in the web interface, or through the Modulus CLI.

Modulus CLI

Run the project create command.

$ modulus project create
Welcome to Modulus
You are logged in as spiderman
[?] Enter a project name: Lizard Locator

You can optionally pass in the name of your project to the project create command.

$ modulus project create "Lizard Locator"
Welcome to Modulus
You are logged in as spiderman
Creating project Lizard Locator
[√] New project Lizard Locator created.

Web Interface

When you first log in you will see an empty project list. Click "Create New Project" and type in your project name.

5. Deploy

Modulus CLI

Run the deploy command. This will zip and deploy your current directory, or the path your provide to the command.

$ cd path/to/project
$ modulus deploy
[?] Are you sure you want to use project Lizard Locator? (yes)
Compressing project...
6.6 MB written
Uploading project...
Upload progress [===================] 100%
Deploying Project...
Deploying [       =            ]
[✓] Lizard Locator running at lizard-locator-895.onmodulus.net

Web Interface

Zip Your Project Directory

You can use any zip tool of your choice. If you’re on Mac or Linux, here’s a convenient way to zip the contents using the command line.

$ cd path/to/project
$ zip -r myProject.zip .
(Don’t forget the dot at the end)

Windows does not provide a zip command by default, but you can zip items through the GUI.

Upload the Zip File

  1. Log in to Modulus and enter your project's dashboard by clicking its name in the project list. Locate the Deploy block in the upper-right-hand corner and click the "Browse" button.
  2. Select the zip file you just created, then click "Upload".
  3. Wait for the deploy dialog to complete. When it's done, your application is live and you will be shown your application's URL. Don't forget to tweet about your first deploy!
Go to top
 

Contact Us

    Our Support Policy
    Submit a Support Request

  • Public Cloud Support Hours
    9am-5pm EST Mon-Fri
    Outside of these hours response times may be up to 24hrs.


    Submit a support ticket by clicking 'status and support' icon on the left side of this page.



help@hellotangible.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en_us/portal/articles/autocomplete