├── LICENSE.md ├── README.md ├── app.js └── package.json /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 NodeSource 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Node.js Docker Tutorial 2 | =============== 3 | 4 | So you have Node apps, and you want to use them with Docker. This repository is designed for helping you follow along with our [blog post](https://nodesource.com/blog/dockerizing-your-nodejs-applications/). It will take you from 0 to 60 with Docker and Node.js! 5 | 6 | ## Solutions 7 | 8 | You can find the solutions to these exercises in the [solutions branch](https://github.com/nodesource/docker-tutorial/tree/solutions) of this repo 9 | 10 | ## Authors and Contributors 11 | 12 | 13 | 14 | 15 |
William BlankenshipGitHub/retrohackerTwitter/@retrohack3r
Theodoros PloumisGitHub/theodorosploumisTwitter/@theoploumis
16 | 17 | ## License & Copyright 18 | 19 | This material is Copyright (c) 2015 NodeSource and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included [LICENSE.md](./LICENSE.md) file for more details. 20 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var pg = require('pg') 2 | var retry = require('retry') 3 | 4 | console.log("Hello World!") 5 | 6 | var operation = retry.operation({retries:3}) 7 | 8 | operation.attempt(function() { 9 | var client = new pg.Client() 10 | client.connect(function(e) { 11 | client.end() 12 | if(operation.retry(e)) { 13 | return; 14 | } 15 | if(!e) console.log("Hello Postgres!") 16 | }) 17 | }) 18 | 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docker-tutorial", 3 | "version": "1.0.0", 4 | "description": "This repository is designed for helping you follow along with the accompanying blog post", 5 | "main": "app.js", 6 | "author": "Will Blankenship ", 7 | "repository": "https://github.com/nodesource/docker-tutorial", 8 | "license": "MIT", 9 | "contributors": [ 10 | "William Blankenship (http://blankenship.io/)" 11 | ], 12 | "dependencies": { 13 | "pg": "^4.4.1", 14 | "retry": "^0.7.0" 15 | } 16 | } 17 | --------------------------------------------------------------------------------