Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
un-hardcode the port
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna Melnikov committed Jan 15, 2022
1 parent c412996 commit c696d27
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import dotenv from "dotenv";
import path = require("path");
import express = require("express");
import hbs = require('hbs');
import { getForecast } from "./utils/forecast";
import { getGeocode, Geocode } from "./utils/geocode";

dotenv.config();

const app = express();
const port = process.env.PORT || 3000;


const viewsPath = path.join(__dirname, "../templates/views");
Expand Down Expand Up @@ -111,7 +115,7 @@ app.get('*', (req, res) => {
res.status(404).render('404', getPageData('404 Not Found', 'page not found'));
})

app.listen(3000, () => {
console.log('Server is up on port 3000');
app.listen(port, () => {
console.log(`Server is up on port ${port}`);
});

0 comments on commit c696d27

Please sign in to comment.