Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change backend port to 8080 #188

Merged
merged 4 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -32,7 +32,7 @@
process.env.BACKEND_API_DEFAULT_PER_MINUTE_RATE_LIMIT || "15",
10,
);
const limiter = RateLimit({

Check warning on line 35 in backend/typescript/server.ts

View workflow job for this annotation

GitHub Actions / run-lint

'limiter' is assigned a value but never used
windowMs: 1 * 60 * 1000, // 1 minute
max: defaultMinuteRateLimit,
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
Expand Down Expand Up @@ -81,8 +81,8 @@
}),
});

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
dns:
- 8.8.8.8
depends_on:
Expand All @@ -42,7 +42,7 @@ services:
context: ./backend/python
dockerfile: Dockerfile
ports:
- 5001:5000
- 8080
dns:
- 8.8.8.8
volumes:
Expand Down
Loading