Skip to content

Commit

Permalink
Change backend port to 8080 (#188)
Browse files Browse the repository at this point in the history
* Change backend port to 8080

* Run backend linter

* Restore timer value

* Add 8080

---------

Co-authored-by: Owen Sellner <[email protected]>
  • Loading branch information
carolynzhang18 and owen-sellner authored Apr 8, 2024
1 parent f068ac9 commit c8ab20e
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ cd starter-code-v2
docker-compose up --build
```

The backend runs at http://localhost:5001 (5000 conflicts with airplay on Mac) and the frontend runs at http://localhost:3000. By default, we use GraphQL (with TypeScript backend), REST (with Python backend), MongoDB, with user auth.
The backend runs at http://localhost:8080 and the frontend runs at http://localhost:3000. By default, we use GraphQL (with TypeScript backend), REST (with Python backend), MongoDB, with user auth.


## Creating a Release
Expand Down
2 changes: 1 addition & 1 deletion backend/python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ RUN pip install -r requirements.txt

COPY . ./app

EXPOSE 5000
EXPOSE 8080
ENTRYPOINT ["python", "server.py"]
22 changes: 11 additions & 11 deletions backend/python/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ def create_app(config_name):
)

if os.getenv("FLASK_CONFIG") != "production":
app.config[
"SQLALCHEMY_DATABASE_URI"
] = "postgresql://{username}:{password}@{host}:5432/{db}".format(
username=os.getenv("POSTGRES_USER"),
password=os.getenv("POSTGRES_PASSWORD"),
host=os.getenv("DB_HOST"),
db=(
os.getenv("POSTGRES_DB_TEST")
if app.config["TESTING"]
else os.getenv("POSTGRES_DB_DEV")
),
app.config["SQLALCHEMY_DATABASE_URI"] = (
"postgresql://{username}:{password}@{host}:5432/{db}".format(
username=os.getenv("POSTGRES_USER"),
password=os.getenv("POSTGRES_PASSWORD"),
host=os.getenv("DB_HOST"),
db=(
os.getenv("POSTGRES_DB_TEST")
if app.config["TESTING"]
else os.getenv("POSTGRES_DB_DEV")
),
)
)
else:
app.config["SQLALCHEMY_DATABASE_URI"] = os.getenv("DATABASE_URL")
Expand Down
1 change: 1 addition & 0 deletions backend/python/app/rest/entity_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# defines a shared URL prefix for all routes
blueprint = Blueprint("entity", __name__, url_prefix="/entities")


# defines GET endpoint for retrieving all entities
@blueprint.route("/", methods=["GET"], strict_slashes=False)
@require_authorization_by_role({"User", "Admin"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-08-16 04:55:26.406967
"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-06-13 17:16:55.426036
"""

from alembic import op
import sqlalchemy as sa

Expand Down
2 changes: 1 addition & 1 deletion backend/python/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
config_name = os.getenv("FLASK_CONFIG") or "development"
app = create_app(config_name)

app.run(host="0.0.0.0", port=int(os.getenv("PORT", 5000)))
app.run(host="0.0.0.0", port=int(os.getenv("PORT", 8080)))
2 changes: 1 addition & 1 deletion backend/typescript/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ RUN yarn install

COPY . ./

EXPOSE 5000
EXPOSE 8080
ENTRYPOINT ["yarn", "dev"]
4 changes: 2 additions & 2 deletions backend/typescript/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ sequelize.authenticate().then(async () => {
}),
});

app.listen({ port: process.env.PORT || 5000 }, () => {
app.listen({ port: process.env.PORT || 8080 }, () => {
/* eslint-disable-next-line no-console */
console.info(`Server is listening on port ${process.env.PORT || 5000}!`);
console.info(`Server is listening on port ${process.env.PORT || 8080}!`);
});
});
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
- ./backend/typescript:/app
- /app/node_modules
ports:
- 5001:5000
- 8080:8080
dns:
- 8.8.8.8
depends_on:
Expand All @@ -42,7 +42,7 @@ services:
context: ./backend/python
dockerfile: Dockerfile
ports:
- 5001:5000
- 8080:8080
dns:
- 8.8.8.8
volumes:
Expand Down

0 comments on commit c8ab20e

Please sign in to comment.