{
    "componentChunkName": "component---src-pages-markdown-remark-fields-slug-js",
    "path": "/full-stack-development/week-2/day-1/labs/heroku-deployment/",
    "result": {"data":{"markdownRemark":{"html":"<h1 id=\"heroku-deployment\" style=\"position:relative;\"><a href=\"#heroku-deployment\" aria-label=\"heroku deployment permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Heroku Deployment</h1>\n<br>\n<br>\n<br>\n<h2 id=\"lesson-objectives\" style=\"position:relative;\"><a href=\"#lesson-objectives\" aria-label=\"lesson objectives permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Lesson Objectives</h2>\n<ol>\n<li>Make sure you completed the MongoDB Atlas Set Up</li>\n<li>Make a new github repository</li>\n<li>Create a basic express app</li>\n<li>set up environmental variables</li>\n<li>Remove <code>node_modules</code></li>\n<li>Get started with Heroku</li>\n<li>Create app on heroku</li>\n<li>Attach mongolab addon</li>\n<li>Update code for heroku &#x26; mongolab</li>\n<li>Push git to heroku</li>\n</ol>\n<br>\n<br>\n<br>\n<h2 id=\"client-server-flow-review\" style=\"position:relative;\"><a href=\"#client-server-flow-review\" aria-label=\"client server flow review permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Client Server Flow Review</h2>\n<br>\n<br>\n<br>\n<h2 id=\"new-github-repository\" style=\"position:relative;\"><a href=\"#new-github-repository\" aria-label=\"new github repository permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>New Github Repository</h2>\n<p>This is going to be a porfolio piece so you'll want it hosted on regular <a href=\"https://github.com/\">github</a>.</p>\n<p>Make a new repo! Click the + on the upper right navigation bar</p>\n<p><img src=\"https://i.imgur.com/Y3IF2lF.png\" alt=\"new repo\"></p>\n<br>\n<p><strong>Choose</strong></p>\n<ul>\n<li>a repository name</li>\n<li>public (let your instructors help you if you get stuck, you can always change this later)</li>\n<li>initialize with a README</li>\n<li><strong>VERY IMPORTANT</strong> <code>Add .gitignore</code> scroll down and choose Node</li>\n<li>license - optional</li>\n</ul>\n<p>Press the <code>Create Repository</code> button when you're ready!</p>\n<br>\n<br>\n<br>\n<h2 id=\"clone-your-new-repository-to-your-computer\" style=\"position:relative;\"><a href=\"#clone-your-new-repository-to-your-computer\" aria-label=\"clone your new repository to your computer permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Clone Your New Repository to Your Computer</h2>\n<p><strong>In Terminal</strong></p>\n<ul>\n<li>\n<p>navigate OUTSIDE the class repository</p>\n</li>\n<li>\n<p>check you are not already in a git repository</p>\n<ul>\n<li><strong>GOOD</strong> -</li>\n</ul>\n<p><img src=\"https://i.imgur.com/9wxsCNd.png\" alt=\"not a repo\"></p>\n<ul>\n<li><strong>BAD</strong>  -</li>\n</ul>\n<p>find a new location for your project!</p>\n<p><img src=\"https://i.imgur.com/dAxjl7t.png\" alt=\"already a repo\"></p>\n</li>\n</ul>\n<br>\n<br>\n<br>\n<p><strong>On Github</strong></p>\n<ul>\n<li>click the <code>Clone or Download</code> button</li>\n<li>check if you are grabbing the right url for <code>https</code> or <code>ssh</code></li>\n<li>click the clipboard button</li>\n</ul>\n<p><img src=\"https://i.imgur.com/zeWKOXk.png\" alt=\"clone or download\"></p>\n<br>\n<br>\n<br>\n<p><strong>In Terminal</strong>\ntype <code>git clone</code> and then paste the URL that you copied from github</p>\n<p>Should look something like this</p>\n<p><img src=\"https://i.imgur.com/u43zNsF.png\" alt=\"clone command in terminal\"></p>\n<ul>\n<li><strong>Important!</strong> Don't forget to cd into your new directory/repo!</li>\n<li><code>ls -a</code> - you should see your <code>README.md</code> and <code>.gitignore</code> that you created on github</li>\n</ul>\n<br>\n<br>\n<br>\n<h2 id=\"basic-express-app\" style=\"position:relative;\"><a href=\"#basic-express-app\" aria-label=\"basic express app permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Basic Express App</h2>\n<p>Let's build a basic express app</p>\n<ul>\n<li><code>touch server.js</code></li>\n<li><code>npm init</code></li>\n<li><code>npm install ejs express mongoose method-override dotenv</code></li>\n</ul>\n<p>Check out <code>package.json</code> make sure everything looks as expected</p>\n<p><img src=\"https://i.imgur.com/KzEzGiw.png\" alt=\"package.json\"></p>\n<br>\n<br>\n<br>\n<h2 id=\"set-environmental-variables\" style=\"position:relative;\"><a href=\"#set-environmental-variables\" aria-label=\"set environmental variables permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Set Environmental Variables</h2>\n<p>We have to set specific to our local computer environment AND our heroku environment. Our variables should <strong>NOT</strong> be tracked by git and should <strong>NOT</strong> be on github.\nThis can keep things like passwords and api keys safer from hacking*. There are a few ways to accomplish this. We're going to store our variables in our <code>.env</code> file which is a file that should NEVER end up on github (because we will ignore it in our <code>.gitignore</code> file) and we can easily export our variables and have access to them on our app.</p>\n<ul>\n<li>True Story: people build bots to crawl through github and find things like API keys, passwords, credit card info and more. They'll grab it and use it. One GA student in 2016 had over $6000 in charges in less than 24 hours on her credit card because she accidentally updated her Amazon credentials!</li>\n</ul>\n<p>We'll need to use an npm package <a href=\"https://www.npmjs.com/package/dotenv\">dotenv</a> to manage this file within our project for us</p>\n<ul>\n<li>one: <code>touch .env</code> (should be on the same level as <code>package.json</code>)</li>\n</ul>\n<p>Add the following:</p>\n<p><strong>IMPORTANT</strong>\nThis file is NOT JavaScript, so the syntax is different</p>\n<ul>\n<li>comments start with a #</li>\n<li>variables go on the left (no spaces/tabs before it) then an <code>=</code> and then the value on the right:\n<ul>\n<li>DO NOT PUT SPACES</li>\n<li>DO NOT PUT SEMI-COLONS</li>\n<li>DO NOT PUT QUOTES</li>\n</ul>\n</li>\n</ul>\n<br>\n<br>\n<br>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"3040278537676100000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied 💾\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# GA project 2 MongoDB Atlas connection String\nMONGODB_URI=mongodb+srv://<your_username>:<password>@ga-sei-u8fme.mongodb.net/test?retryWrites=true&w=majority\n\n# Port for localhost\nPORT=3000`, `3040278537676100000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-bash line-numbers\"><code class=\"language-bash\"><span class=\"token comment\"># GA project 2 MongoDB Atlas connection String</span>\n<span class=\"token assign-left variable\">MONGODB_URI</span><span class=\"token operator\">=</span>mongodb+srv://<span class=\"token operator\">&lt;</span>your_username<span class=\"token operator\">></span>:<span class=\"token operator\">&lt;</span>password<span class=\"token operator\">></span>@ga-sei-u8fme.mongodb.net/test?retryWrites<span class=\"token operator\">=</span>true<span class=\"token operator\">&amp;</span><span class=\"token assign-left variable\">w</span><span class=\"token operator\">=</span>majority\n\n<span class=\"token comment\"># Port for localhost</span>\n<span class=\"token assign-left variable\">PORT</span><span class=\"token operator\">=</span><span class=\"token number\">3000</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<br>\n<br>\n<br>\n<p>Replace the MONGODB_URI with the one provided to you from YOUR MongoDB Atlas, be sure to swap out <code>&#x3C;password></code> (be sure to remove the <code>&#x3C;></code>s as well your password should just be <code>password1234</code> not <code>&#x3C;password1234></code>) with the password you created for your user through Atlas.</p>\n<p>Load your changes</p>\n<p><strong>in server.js</strong></p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"68426547680339710000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied 💾\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`require('dotenv').config()\n\n//___________________\n//Dependencies\n//___________________\nconst express = require('express');\nconst methodOverride = require('method-override');\nconst mongoose = require ('mongoose');\nconst app = express();\nconst db = mongoose.connection;\n//___________________\n//Port\n//___________________\n// Allow use of Heroku's port or your own local port, depending on the environment\nconst PORT = process.env.PORT || 3000;\n\n//___________________\n//Database\n//___________________\n// How to connect to the database either via heroku or locally\nconst MONGODB_URI = process.env.MONGODB_URI;\n\n// Connect to Mongo &\n// Fix Depreciation Warnings from Mongoose\n// May or may not need these depending on your Mongoose version\nmongoose.connect(MONGODB_URI , { useNewUrlParser: true, useUnifiedTopology: true }\n);\n\n// Error / success\ndb.on('error', (err) => console.log(err.message + ' is mongod not running?'));\ndb.on('connected', () => console.log('mongod connected: ', MONGODB_URI));\ndb.on('disconnected', () => console.log('mongod disconnected'));\n\n//___________________\n//Middleware\n//___________________\n\n//use public folder for static assets\napp.use(express.static('public'));\n\n// populates req.body with parsed info from forms - if no data from forms will return an empty object {}\napp.use(express.urlencoded({ extended: false }));// extended: false - does not allow nested objects in query strings\napp.use(express.json());// returns middleware that only parses JSON - may or may not need it depending on your project\n\n//use method override\napp.use(methodOverride('_method'));// allow POST, PUT and DELETE from a form\n\n\n//___________________\n// Routes\n//___________________\n//localhost:3000\napp.get('/' , (req, res) => {\n  res.send('Hello World!');\n});\n\n//___________________\n//Listener\n//___________________\napp.listen(PORT, () => console.log('express is listening on:', PORT));\n`, `68426547680339710000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-js line-numbers\"><code class=\"language-js\"><span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'dotenv'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">config</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n\n<span class=\"token comment\">//___________________</span>\n<span class=\"token comment\">//Dependencies</span>\n<span class=\"token comment\">//___________________</span>\n<span class=\"token keyword\">const</span> express <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'express'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">const</span> methodOverride <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'method-override'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">const</span> mongoose <span class=\"token operator\">=</span> <span class=\"token function\">require</span> <span class=\"token punctuation\">(</span><span class=\"token string\">'mongoose'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">const</span> app <span class=\"token operator\">=</span> <span class=\"token function\">express</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">const</span> db <span class=\"token operator\">=</span> mongoose<span class=\"token punctuation\">.</span>connection<span class=\"token punctuation\">;</span>\n<span class=\"token comment\">//___________________</span>\n<span class=\"token comment\">//Port</span>\n<span class=\"token comment\">//___________________</span>\n<span class=\"token comment\">// Allow use of Heroku's port or your own local port, depending on the environment</span>\n<span class=\"token keyword\">const</span> <span class=\"token constant\">PORT</span> <span class=\"token operator\">=</span> process<span class=\"token punctuation\">.</span>env<span class=\"token punctuation\">.</span><span class=\"token constant\">PORT</span> <span class=\"token operator\">||</span> <span class=\"token number\">3000</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token comment\">//___________________</span>\n<span class=\"token comment\">//Database</span>\n<span class=\"token comment\">//___________________</span>\n<span class=\"token comment\">// How to connect to the database either via heroku or locally</span>\n<span class=\"token keyword\">const</span> <span class=\"token constant\">MONGODB_URI</span> <span class=\"token operator\">=</span> process<span class=\"token punctuation\">.</span>env<span class=\"token punctuation\">.</span><span class=\"token constant\">MONGODB_URI</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token comment\">// Connect to Mongo &amp;</span>\n<span class=\"token comment\">// Fix Depreciation Warnings from Mongoose</span>\n<span class=\"token comment\">// May or may not need these depending on your Mongoose version</span>\nmongoose<span class=\"token punctuation\">.</span><span class=\"token function\">connect</span><span class=\"token punctuation\">(</span><span class=\"token constant\">MONGODB_URI</span> <span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span> useNewUrlParser<span class=\"token operator\">:</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">,</span> useUnifiedTopology<span class=\"token operator\">:</span> <span class=\"token boolean\">true</span> <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token comment\">// Error / success</span>\ndb<span class=\"token punctuation\">.</span><span class=\"token function\">on</span><span class=\"token punctuation\">(</span><span class=\"token string\">'error'</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">err</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> console<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span>err<span class=\"token punctuation\">.</span>message <span class=\"token operator\">+</span> <span class=\"token string\">' is mongod not running?'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\ndb<span class=\"token punctuation\">.</span><span class=\"token function\">on</span><span class=\"token punctuation\">(</span><span class=\"token string\">'connected'</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> console<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">'mongod connected: '</span><span class=\"token punctuation\">,</span> <span class=\"token constant\">MONGODB_URI</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\ndb<span class=\"token punctuation\">.</span><span class=\"token function\">on</span><span class=\"token punctuation\">(</span><span class=\"token string\">'disconnected'</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> console<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">'mongod disconnected'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token comment\">//___________________</span>\n<span class=\"token comment\">//Middleware</span>\n<span class=\"token comment\">//___________________</span>\n\n<span class=\"token comment\">//use public folder for static assets</span>\napp<span class=\"token punctuation\">.</span><span class=\"token function\">use</span><span class=\"token punctuation\">(</span>express<span class=\"token punctuation\">.</span><span class=\"token function\">static</span><span class=\"token punctuation\">(</span><span class=\"token string\">'public'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token comment\">// populates req.body with parsed info from forms - if no data from forms will return an empty object {}</span>\napp<span class=\"token punctuation\">.</span><span class=\"token function\">use</span><span class=\"token punctuation\">(</span>express<span class=\"token punctuation\">.</span><span class=\"token function\">urlencoded</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span> extended<span class=\"token operator\">:</span> <span class=\"token boolean\">false</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span><span class=\"token comment\">// extended: false - does not allow nested objects in query strings</span>\napp<span class=\"token punctuation\">.</span><span class=\"token function\">use</span><span class=\"token punctuation\">(</span>express<span class=\"token punctuation\">.</span><span class=\"token function\">json</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span><span class=\"token comment\">// returns middleware that only parses JSON - may or may not need it depending on your project</span>\n\n<span class=\"token comment\">//use method override</span>\napp<span class=\"token punctuation\">.</span><span class=\"token function\">use</span><span class=\"token punctuation\">(</span><span class=\"token function\">methodOverride</span><span class=\"token punctuation\">(</span><span class=\"token string\">'_method'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span><span class=\"token comment\">// allow POST, PUT and DELETE from a form</span>\n\n\n<span class=\"token comment\">//___________________</span>\n<span class=\"token comment\">// Routes</span>\n<span class=\"token comment\">//___________________</span>\n<span class=\"token comment\">//localhost:3000</span>\napp<span class=\"token punctuation\">.</span><span class=\"token function\">get</span><span class=\"token punctuation\">(</span><span class=\"token string\">'/'</span> <span class=\"token punctuation\">,</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">req<span class=\"token punctuation\">,</span> res</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n  res<span class=\"token punctuation\">.</span><span class=\"token function\">send</span><span class=\"token punctuation\">(</span><span class=\"token string\">'Hello World!'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token comment\">//___________________</span>\n<span class=\"token comment\">//Listener</span>\n<span class=\"token comment\">//___________________</span>\napp<span class=\"token punctuation\">.</span><span class=\"token function\">listen</span><span class=\"token punctuation\">(</span><span class=\"token constant\">PORT</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> console<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">'express is listening on:'</span><span class=\"token punctuation\">,</span> <span class=\"token constant\">PORT</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<br>\n<br>\n<br>\n<h2 id=\"test-your-app\" style=\"position:relative;\"><a href=\"#test-your-app\" aria-label=\"test your app permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Test your app</h2>\n<ul>\n<li>If your express app doesn't run locally it definitely won't run on Heroku!</li>\n<li>test it out and fix any bugs</li>\n</ul>\n<br>\n<br>\n<br>\n<h2 id=\"git-addgit-commit\" style=\"position:relative;\"><a href=\"#git-addgit-commit\" aria-label=\"git addgit commit permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>git add/git commit</h2>\n<ul>\n<li><code>git add .</code></li>\n<li><code>git commit -m 'first commit'</code></li>\n<li><code>git push origin master</code></li>\n</ul>\n<p>Check this step carefully! Make sure <code>node_modules</code> are <strong>NOT</strong> on github!! If they made it to github, that means they are not being ignored by <code>.gitignore</code>. If you don't properly ignore them now you'll have massive headaches with heroku later!</p>\n<br>\n<br>\n<br>\n<h2 id=\"if-you-need-to-remove-node_modules\" style=\"position:relative;\"><a href=\"#if-you-need-to-remove-node_modules\" aria-label=\"if you need to remove node_modules permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>If You Need to Remove <code>node_modules</code></h2>\n<p>In order for heroku to work, you can't have <code>node_modules</code> in your repo.  Instead, heroku will add this dir itself!</p>\n<ol>\n<li>go to local repo dir</li>\n<li><code>rm -r node_modules</code></li>\n<li>git: add, commit, push</li>\n<li><code>touch .gitignore</code></li>\n<li><code>atom .gitignore</code></li>\n<li>add a line that says just <code>node_modules</code> to .gitignore</li>\n<li>save .gitignore</li>\n<li>git: add, commit, push</li>\n<li>to get it working locally again: <code>npm install</code></li>\n</ol>\n<br>\n<br>\n<br>\n<h2 id=\"get-started-with-heroku\" style=\"position:relative;\"><a href=\"#get-started-with-heroku\" aria-label=\"get started with heroku permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Get started with Heroku</h2>\n<ul>\n<li><a href=\"https://signup.heroku.com/\">Sign up for Heroku</a>\n<ul>\n<li>You may need a CC at some point although you will not be charged</li>\n</ul>\n</li>\n<li><a href=\"https://toolbelt.heroku.com/\">Install Heroku CLI Tools</a>\n<ul>\n<li>Verify by typing <code>heroku login</code> anywhere in your terminal</li>\n<li>Follow prompts to sync up your heroku credentials, DO NOT HEROKU CREATE yet.</li>\n</ul>\n</li>\n</ul>\n<br>\n<br>\n<br>\n<h2 id=\"create-an-app-on-heroku\" style=\"position:relative;\"><a href=\"#create-an-app-on-heroku\" aria-label=\"create an app on heroku permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Create an app on heroku</h2>\n<ul>\n<li>Once you have Heroku CLI, you can access terminal commands to heroku.</li>\n<li>Let's start by creating an app on heroku. If you don't yet have a name for your app it's ok, you can change it later (just make sure you update your git remotes too)\n<ul>\n<li><code>heroku create [unique name]</code> from your project's root directory where you first initialized git.</li>\n</ul>\nThis will check heroku to see if the app name exists, if so you'll get an error message and have to try again.\n<ul>\n<li>If you don't specify a name, heroku will generate a unique name for you. There names are pretty cool and somewhat thematic so feel free to do either.</li>\n<li>You can also do this step off their website if you want but since you'll be working in terminal anyway, might as well just do it through terminal.</li>\n<li>Notice that if you successfully created a heroku app, you can see that the heroku remote was automatically added to your project's repo. Confirm this by typing <code>git remote -v</code>, you should see <code>origin</code> as well as <code>heroku</code>.</li>\n</ul>\n</li>\n</ul>\n<br>\n<br>\n<br>\n<h2 id=\"add-database-from-mongodb-atlas\" style=\"position:relative;\"><a href=\"#add-database-from-mongodb-atlas\" aria-label=\"add database from mongodb atlas permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Add Database from MongoDB Atlas</h2>\n<p>Go to <a href=\"https://dashboard.heroku.com/\">heroku</a> - make sure you are logged in and go to your app</p>\n<p>Go to the settings tab</p>\n<p><img src=\"https://i.imgur.com/citTnDN.png\" alt=\"\"></p>\n<p>push the <code>reveal config vars</code> button</p>\n<p>in there add:</p>\n<p><img src=\"https://i.imgur.com/9CKHcBM.png\" alt=\"\"></p>\n<ul>\n<li>make sure <code>MONGODB_URI</code> key matches perfectly what you have in your <code>server.js</code> file for connecting with mongoose.</li>\n<li>make the property your connection string from Atlas with <em>YOUR</em> username password filled in</li>\n</ul>\n<br>\n<br>\n<br>\n<h2 id=\"push-git\" style=\"position:relative;\"><a href=\"#push-git\" aria-label=\"push git permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Push Git</h2>\n<ul>\n<li>First update your remote repo so you're code is up to date.\n<ul>\n<li><code>git add -A</code></li>\n<li><code>git commit -m \"updating code for heroku\"</code></li>\n<li><code>git push origin master</code></li>\n</ul>\n</li>\n<li>Now also push to heroku\n<ul>\n<li><code>git push heroku master</code></li>\n</ul>\n</li>\n</ul>\n<p>Wait 1 minute then type <code>heroku open</code>. You should have your deployed app open up in your browser.</p>\n<ul>\n<li>If thing's don't work out, relax and try to find out the error.</li>\n<li><code>heroku logs</code></li>\n</ul>\n<br>\n<br>\n<br>\n<h1 id=\"troubleshooting\" style=\"position:relative;\"><a href=\"#troubleshooting\" aria-label=\"troubleshooting permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Troubleshooting</h1>\n<p>You only need to follow this section <strong>if you're having any of the following weird errors!</strong></p>\n<br>\n<br>\n<br>\n<h4 id=\"heroku-cant-figure-out-your-language\" style=\"position:relative;\"><a href=\"#heroku-cant-figure-out-your-language\" aria-label=\"heroku cant figure out your language permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Heroku Can't Figure Out Your Language</h4>\n<ul>\n<li>the hidden folder <code>.git</code> and <code>package.json</code> MUST be on the same level in your directory (the root)</li>\n<li>if it is a Rails app, <code>.git</code> and <code>GemFile</code> MUST be on the same level in your directory (the root)</li>\n<li>move your files up to <code>.git</code> accordingly</li>\n</ul>\n<br>\n<br>\n<br>\n<h4 id=\"check-that-your-have-ignored-node-modules\" style=\"position:relative;\"><a href=\"#check-that-your-have-ignored-node-modules\" aria-label=\"check that your have ignored node modules permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Check that your have ignored node modules</h4>\n<p>Your node modules should NOT appear on github</p>\n<p><img src=\"https://i.imgur.com/PVYeHAf.png\" alt=\"no node modules\"></p>\n<p>If you have not ignored your node modules, follow the steps listed above to remove and ignore them</p>\n<br>\n<br>\n<br>\n<h4 id=\"heroku-recommends-setting-the-proper-node-version\" style=\"position:relative;\"><a href=\"#heroku-recommends-setting-the-proper-node-version\" aria-label=\"heroku recommends setting the proper node version permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Heroku recommends setting the proper node version</h4>\n<p><a href=\"https://devcenter.heroku.com/articles/deploying-nodejs\">scroll down for an example</a></p>\n<br>\n<br>\n<br>\n<h4 id=\"check-that-your-config-variables-match\" style=\"position:relative;\"><a href=\"#check-that-your-config-variables-match\" aria-label=\"check that your config variables match permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Check that your config variables match</h4>\n<p>In heroku, under your app and its settings, <code>Reveal Config Vars</code></p>\n<p><img src=\"https://i.imgur.com/HyPWKAq.png\" alt=\"reveal config vars\"></p>\n<p>In the above example -</p>\n<p>In your own app, make sure you have your mongo uri equal to <code>process.env</code> and then <code>.MONGODB_URI</code></p>\n<p><code>const mongoURI = process.env.MONGODB_URI</code></p>\n<p>It won't work if you make it a different variable name (lowercase, no underscore) - do not change it in heroku! If you cange it in heroku you'll have to hunt how to update more things. Just set it in your own app.</p>\n<p>Note: your the variable for the port is not listed, but it must be <code>PORT</code> all caps. It is accessed by <code>process.env.PORT</code></p>\n<br>\n<br>\n<br>\n<h4 id=\"you-need-to-add-more-config-variables\" style=\"position:relative;\"><a href=\"#you-need-to-add-more-config-variables\" aria-label=\"you need to add more config variables permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>You Need to Add More Config Variables</h4>\n<p>Using the NPM package <code>dotenv</code>? If you've added new variables, like <code>SECRET</code>, be sure to add those custum config variables</p>\n<ul>\n<li>In heroku, under your app and its settings, <code>Reveal Config Vars</code></li>\n</ul>\n<p>Otherwise you might be looking at a <code>Internal server error</code></p>\n<p><img src=\"https://i.imgur.com/HyPWKAq.png\" alt=\"reveal config vars\"></p>\n<p>You must make the variable names match.</p>\n<br>\n<br>\n<br>\n<h4 id=\"you-changed-your-heroku-url\" style=\"position:relative;\"><a href=\"#you-changed-your-heroku-url\" aria-label=\"you changed your heroku url permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>You changed your heroku URL</h4>\n<p>If you changed your app name, you'll have to update the git remote url. Get the right url from heroku (see towards the bottom</p>\n<p><img src=\"https://i.imgur.com/gU905lY.png\" alt=\"right url\"></p>\n<p>In terminal, in your repo</p>\n<ul>\n<li><code>git remote -v</code> (should have origin and heroku)</li>\n<li><code>git remote remove heroku</code></li>\n<li><code>git remote add heroku whateverURLherokuListed</code></li>\n</ul>\n<br>\n<br>\n<br>\n<h3 id=\"you-changed-your-github-project-name\" style=\"position:relative;\"><a href=\"#you-changed-your-github-project-name\" aria-label=\"you changed your github project name permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>You changed your github project name</h3>\n<p><img src=\"https://i.imgur.com/NOZ16yV.png\" alt=\"changed github project name\"></p>\n<p>Go back to the main code view and grab the url from the clone or download button</p>\n<p><img src=\"https://i.imgur.com/TDZAWNl.png\" alt=\"git clone\"></p>\n<ul>\n<li><code>git remote -v</code> (should have origin and heroku)</li>\n<li><code>git remote remove origin</code></li>\n<li><code>git remote add origin whateverURLgithubListed</code></li>\n</ul>\n<br>\n<br>\n<br>\n<h4 id=\"cannot-read-filetype-mime-re-css-file\" style=\"position:relative;\"><a href=\"#cannot-read-filetype-mime-re-css-file\" aria-label=\"cannot read filetype mime re css file permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Cannot read filetype MIME re: CSS file</h4>\n<ul>\n<li>your CSS file is not linked properly/cannot be found/named incorrectly (working locally? see next issue)</li>\n<li>you have a mismatch in opening/closing HTML tags</li>\n</ul>\n<br>\n<br>\n<br>\n<h4 id=\"cannot-find-a-file-but-it-is-there-you-think-you-might-have-changed-it\" style=\"position:relative;\"><a href=\"#cannot-find-a-file-but-it-is-there-you-think-you-might-have-changed-it\" aria-label=\"cannot find a file but it is there you think you might have changed it permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Cannot find a file but it is there??? You think you might have changed it?</h4>\n<p>There is weirdness. If you had named your file <code>Index.html</code> and then changed it to <code>index.html</code> git, by default, will ignore this change.</p>\n<p>Locally, you'll see <code>index.html</code> (your updated name). But if you go to github, you'll see it's still <code>Index.html</code>. This will 'confuse' heroku as well.</p>\n<p>First try to use git to change the name:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"53661097666825480000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied 💾\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`git mv -f Index.html index.html`, `53661097666825480000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-bash line-numbers\"><code class=\"language-bash\"><span class=\"token function\">git</span> <span class=\"token function\">mv</span> -f Index.html index.html</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span></span></pre></div>\n<p>Success?</p>\n<p><img src=\"https://i.imgur.com/hvqvkTR.png\" alt=\"changed file name\"></p>\n<p>go ahead and <code>git add .</code> <code>git commit -m 'file name changed'</code></p>\n<p>If that fails,</p>\n<ul>\n<li><code>touch tempfile</code>,</li>\n<li>copy paste your code from the offending file in there</li>\n<li><code>rm</code> the offending file</li>\n<li><code>git add .</code> <code>git commit -m 'removed Index.html</code></li>\n<li><code>touch index.html</code></li>\n<li><code>git add .</code> <code>git commit -m 'added index.html</code></li>\n</ul>","frontmatter":{"title":"Heroku Deployment"}}},"pageContext":{"id":"5277bb97-83fd-5839-8fdd-325c15cfb5ba","fields__slug":"/full-stack-development/week-2/day-1/labs/heroku-deployment/","__params":{"fields__slug":"full-stack-development"}}},
    "staticQueryHashes": ["1636016182","3810076356"]}