-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add official guide of node.js applications
- Loading branch information
Showing
1 changed file
with
3 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,4 @@ | ||
# Nodejs platform | ||
Node.js platform | ||
=========== | ||
|
||
The Nodejs platform uses nvm to run your code and you can choose what node | ||
version you want to run it. To define node version you have three ways: | ||
|
||
* .nvmrc | ||
$ cat .nvmrc | ||
4.4.0 | ||
* .node-version | ||
$ cat .node-version | ||
4.4.0 | ||
* package.json | ||
$ cat package.json | ||
... | ||
"engines": { | ||
"node": "4.2.6", | ||
}, | ||
... | ||
|
||
This file should be in the root of deploy files. | ||
|
||
$ ls | ||
Procfile app.js hook.js package.json | ||
|
||
To install your dependencies, first we check if there is a `yarn.lock` file | ||
in the root of your files. If so, we use [yarn](https://yarnpkg.com/); | ||
otherwise, we use [npm](https://www.npmjs.com/package/npm). | ||
|
||
You have to list your dependencies in the `package.json` file. | ||
|
||
$ cat package.json | ||
... | ||
"dependencies": { | ||
"express": "3.x" | ||
} | ||
... | ||
|
||
If you want to also install development dependencies, set the environment | ||
variable ``NPM_CONFIG_PRODUCTION=false``. Otherwise, we'll only install | ||
regular dependencies. | ||
You can also cache your node_modules by setting environment variable | ||
``KEEP_NODE_MODULES=true``. | ||
Official guide: https://tsuru.github.io/docs/user_guides/deploy_nodejs_apps/ |