Skip to content

Commit

Permalink
Port and URL changes to support production
Browse files Browse the repository at this point in the history
  • Loading branch information
parK-dev committed Jun 22, 2021
1 parent d4fb386 commit 1e91626
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion weather-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"eslint": "^7.29.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start": "node src/app.js"
},
"keywords": [],
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion weather-app/public/js/getWeather.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const card = document.getElementById('card');
search.addEventListener('click', (e) => {
const location = form.value;
e.preventDefault();
fetch(`http://localhost:3000/weather?address=${location}!`).then((response) => {
fetch(`/weather?address=${location}!`).then((response) => {
response.json().then((data) => {
if (data.error) {
form.placeholder = `${data.error}`
Expand Down
3 changes: 2 additions & 1 deletion weather-app/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import hbs from 'hbs';

const app = express();
const __dirname = dirname(fileURLToPath(import.meta.url));
const port = process.env.PORT || 3000;

// Bootstrap
app.use('/css', express.static(path.join(__dirname, 'node_modules/bootstrap/dist/css')))
Expand Down Expand Up @@ -63,6 +64,6 @@ app.get('*', (req, res) => {
res.send('My 404 page');
});

app.listen(3000, () => {
app.listen(port, () => {

});

0 comments on commit 1e91626

Please sign in to comment.