├── .gitignore ├── Procfile ├── app.json ├── index.js ├── package.json ├── README.md └── public └── node.svg /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: node index.js 2 | 3 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Node.js Sample", 3 | "description": "A barebones Node.js app using Express 4", 4 | "repository": "https://github.com/heroku/node-js-sample", 5 | "logo": "https://rawgit.com/heroku/node-js-sample/master/public/node.svg", 6 | "keywords": ["node", "express", "static"] 7 | } 8 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var express = require('express') 2 | var app = express() 3 | 4 | app.set('port', (process.env.PORT || 5000)) 5 | app.use(express.static(__dirname + '/public')) 6 | 7 | app.get('/', function(request, response) { 8 | response.send('Hello World!') 9 | }) 10 | 11 | app.listen(app.get('port'), function() { 12 | console.log("Node app is running at localhost:" + app.get('port')) 13 | }) 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-js-sample", 3 | "version": "0.2.0", 4 | "description": "A sample Node.js app using Express 4", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "dependencies": { 10 | "express": "^4.13.3" 11 | }, 12 | "engines": { 13 | "node": "4.0.0" 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/heroku/node-js-sample" 18 | }, 19 | "keywords": [ 20 | "node", 21 | "heroku", 22 | "express" 23 | ], 24 | "author": "Mark Pundsack", 25 | "contributors": [ 26 | "Zeke Sikelianos (http://zeke.sikelianos.com)" 27 | ], 28 | "license": "MIT" 29 | } 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # node-js-sample 2 | 3 | A barebones Node.js app using [Express 4](http://expressjs.com/). 4 | 5 | ## Running Locally 6 | 7 | Make sure you have [Node.js](http://nodejs.org/) and the [Heroku Toolbelt](https://toolbelt.heroku.com/) installed. 8 | 9 | ```sh 10 | git clone git@github.com:heroku/node-js-sample.git # or clone your own fork 11 | cd node-js-sample 12 | npm install 13 | npm start 14 | ``` 15 | 16 | Your app should now be running on [localhost:5000](http://localhost:5000/). 17 | 18 | ## Deploying to Heroku 19 | 20 | ``` 21 | heroku create 22 | git push heroku master 23 | heroku open 24 | ``` 25 | 26 | Alternatively, you can deploy your own copy of the app using the web-based flow: 27 | 28 | [![Deploy to Heroku](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) 29 | 30 | ## Documentation 31 | 32 | For more information about using Node.js on Heroku, see these Dev Center articles: 33 | 34 | - [10 Habits of a Happy Node Hacker](https://blog.heroku.com/archives/2014/3/11/node-habits) 35 | - [Getting Started with Node.js on Heroku](https://devcenter.heroku.com/articles/getting-started-with-nodejs) 36 | - [Heroku Node.js Support](https://devcenter.heroku.com/articles/nodejs-support) 37 | - [Node.js on Heroku](https://devcenter.heroku.com/categories/nodejs) 38 | - [Using WebSockets on Heroku with Node.js](https://devcenter.heroku.com/articles/node-websockets) 39 | -------------------------------------------------------------------------------- /public/node.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 12 | 17 | 18 | --------------------------------------------------------------------------------