Compare commits

..

5 Commits

Author SHA1 Message Date
20c1fd7be9 Ensure API Response is in English
added English to the API URL to ensure the returned JSON is in English. I'm leaving the Headers language in place, but it is not as reliable
2025-06-29 11:50:29 -04:00
2800d2fb2e sorting now default starting with most recently created 2024-10-04 23:35:00 -04:00
cce705c4f7 for now, cors supports all 2024-09-12 19:33:14 -04:00
ed889d95e6 added docker support 2024-09-12 19:32:45 -04:00
c61d0c40af added docker support 2024-09-12 19:32:09 -04:00
7 changed files with 89 additions and 3 deletions

15
.dockerignore Normal file
View File

@@ -0,0 +1,15 @@
node_modules
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
Makefile
helm-charts
.env
.editorconfig
.idea
coverage*

2
.gitignore vendored
View File

@@ -130,3 +130,5 @@ dist
.yarn/install-state.gz
.pnp.*
# docker-compose.yml
docker-compose.yml

48
Dockerfile Normal file
View File

@@ -0,0 +1,48 @@
# use the official Bun image
# see all versions at https://hub.docker.com/r/oven/bun/tags
FROM oven/bun:1 AS base
WORKDIR /usr/src/app
# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
# copy production dependencies and source code into final image
FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app/ .
COPY --from=prerelease /usr/src/app/package.json .
# Set Environment Variables
ARG NODE_ENV=production
ENV NODE_ENV=$NODE_ENV
ENV ACCESS_TOKEN_SECRET=$ACCESS_TOKEN_SECRET
ENV REFRESH_TOKEN_SECRET=$REFRESH_TOKEN_SECRET
ENV JWT_EXPIRES=$JWT_EXPIRES
ENV MONGO_URI=$MONGO_URI
ENV SMTP_HOST=$SMTP_HOST
ENV SMTP_PORT=$SMTP_PORT
ENV SMTP_USER=$SMTP_USER
ENV SMTP_PASSWORD=$SMTP_PASSWORD
ENV FROM_EMAIL=$FROM_EMAIL
ENV FROM_NAME=$FROM_NAME
ENV SECURE=$SECURE
# run the app
USER bun
EXPOSE 5000/tcp
ENTRYPOINT [ "bun", "./bin/www.js" ]

2
app.js
View File

@@ -41,7 +41,7 @@ const limiter = rateLimit({
max: 100
})
app.use(express.json(), cookieParser(), morgan('dev'), mongoSanitize(), helmet(), xss(), limiter, hpp(), cors(corsOptions))
app.use(express.json(), cookieParser(), morgan('dev'), mongoSanitize(), helmet(), xss(), limiter, hpp(), cors())
app.use('/api/admin/games', adminGames)
app.use('/api/games', games)

View File

@@ -0,0 +1,21 @@
---
services:
games-api:
image: games-api
build: .
container_name: games-api
environment:
- ACCESS_TOKEN_SECRET=
- JWT_EXPIRE=
- REFRESH_TOKEN_SECRET=
- MONGO_URI=
- SMTP_HOST=
- SMTP_PORT=
- SMTP_USER=
- SMTP_PASSWORD=
- FROM_EMAIL=
- FROM_NAME=
- SECURE=false
ports:
- 5000:5000

View File

@@ -162,7 +162,7 @@ const advancedResults = (model, populate) => async (req, res, next) => {
const sortBy = req.query.sort.split(',').join(' ')
query = query.sort(sortBy)
} else {
query = query.sort('series title')
query = query.sort('-createDate series title')
}
// Pagination

View File

@@ -6,7 +6,7 @@ const steamScraper = async (resData) => {
if (steamId === null || steamId === '') {
return 'Please enter a valid Steam Id'
}
const steamApiUrl = `https://store.steampowered.com/api/appdetails/?appids=${steamId}`
const steamApiUrl = `https://store.steampowered.com/api/appdetails/?appids=${steamId}&l=english`
const steamRatingApiUrl = `https://store.steampowered.com/appreviews/${steamId}?json=1`
const steamWebUrl = `https://store.steampowered.com/app/${steamId}`
try {