Skip to content

Commit

Permalink
Fix unhandled rejected promise. Error was that boradgame.io does not …
Browse files Browse the repository at this point in the history
…like subfolders of the db/ folder
  • Loading branch information
ChristophNiehoff committed Oct 15, 2021
1 parent c936918 commit ba1eb06
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ yarn-debug.log*
yarn-error.log*

db/
deploy/
db-images/
deploy/
File renamed without changes.
2 changes: 1 addition & 1 deletion docker/server.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ WORKDIR /usr/src/app
RUN chown node:node /usr/src/app
USER node
ENV NODE_ENV production
RUN mkdir -p /usr/src/app/db/images
RUN mkdir -p /usr/src/app/db-images
COPY --chown=node:node --from=builder /usr/src/app/node_modules /usr/src/app/node_modules
COPY --chown=node:node ./src/server /usr/src/app/src/server
COPY --chown=node:node ./src/game /usr/src/app/src/game
Expand Down
2 changes: 1 addition & 1 deletion heroku/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY package*.json ./
RUN npm install
COPY src ./src
COPY public ./public
RUN mkdir -p ./db/images
RUN mkdir -p ./db-images

RUN npm run build

Expand Down
4 changes: 2 additions & 2 deletions src/server/endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const createGame = gameServer => async (ctx, next) => {
throw Error("Filetype not supported");
}

await rename(ctx.request.files.model.path, `./db/images/${gameId}.${extension}`);
await rename(ctx.request.files.model.path, `./db-images/${gameId}.${extension}`);
//use model object to store info about image
await gameServer.db.setModel(gameId, {extension});

Expand Down Expand Up @@ -97,7 +97,7 @@ export const getImage = gameServer => async ctx => {
const game = await gameServer.db.fetch(matchID, { model: true });

//send image
await send(ctx, `${matchID}.${game.model.extension}`, {root: './db/images'});
await send(ctx, `${matchID}.${game.model.extension}`, {root: './db-images'});
}

export const downloadThreatDragonModel = gameServer => async ctx => {
Expand Down
2 changes: 1 addition & 1 deletion src/server/publicApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const runPublicApi = gameServer => {
//require authentication for all routes starting with `/:matchID/*`
router.use('/:matchID/', authMiddleware(gameServer));

router.post('/create', koaBody({multipart: true, formidable: {uploadDir: './db/images'}}), createGame(gameServer));
router.post('/create', koaBody({multipart: true, formidable: {uploadDir: './db-images'}}), createGame(gameServer));
router.get('/:matchID/players', getPlayerNames(gameServer));
router.get('/:matchID/model', getModel(gameServer));
router.get('/:matchID/image', getImage(gameServer));
Expand Down

0 comments on commit ba1eb06

Please sign in to comment.