itp-dwd / 2020-spring

Repo for Dynamic Web Development Spring, 2020
26 stars 18 forks source link

Deploying Web Apps, Gotcha's and Uh-Ohs #80

Closed joeyklee closed 4 years ago

joeyklee commented 4 years ago

Things to remember:

  1. package.json needs a "start" script otherwise your app won't run!

{ "name": "todo-app", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "node index.js", }, "keywords": [], "author": "", "license": "ISC", "dependencies": {}, "devDependencies": {} }


2. `app.listen()` should always go at the end of your server-side `index.js` file

3. if you are running a web server to serve your HTML files, remember you don't need to have a `localhost` reference in your `fetch()` requests: e.g.
   ```js
   await fetch("http://localhost:3000/api/dogs", ...)

can just be:

   await fetch("/api/dogs", ...)
joeyklee commented 4 years ago

Added this info to: https://github.com/itp-dwd/2020-spring/blob/master/guides/project-development-checklist.md