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

I404 backend update #415

Merged
8 changes: 4 additions & 4 deletions ccm_web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# - https://dev.to/chrsgrrtt/dockerising-a-next-js-project-1ck5

# Base stage
FROM node:16-slim AS base
FROM node:20-slim AS base
WORKDIR /base/

COPY package*.json ./
Expand All @@ -14,14 +14,14 @@ ARG PORT
EXPOSE ${PORT}

# Build stage (build client and compile server to JS)
FROM node:16-slim AS build
FROM node:20-slim AS build
WORKDIR /build/

COPY --from=base /base ./
RUN npm run build

# Prod stage
FROM node:16-slim AS prod
FROM node:20-slim AS prod
ENV NODE_ENV=production
WORKDIR /app

Expand All @@ -32,7 +32,7 @@ COPY --from=base \
/base/ecosystem.config.js \
./
RUN npm install --production
RUN npm install pm2@5.2.0 -g
RUN npm install pm2@5.3.1 -g
COPY --from=build /build/dist/ ./

# Set PM2_HOME so that .pm2 files are written in /tmp/
Expand Down
8 changes: 4 additions & 4 deletions ccm_web/client/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const jsonMimeType = 'application/json'

export const getCSRFToken = (): string | undefined => Cookies.get('CSRF-Token')

const initCSRFRequest = (headers: string[][]): RequestInit => {
const initCSRFRequest = (headers: Array<[string, string]>): RequestInit => {
const csrfToken = getCSRFToken()
if (csrfToken !== undefined) headers.push(['CSRF-Token', csrfToken])
const request: RequestInit = { headers }
Expand All @@ -25,15 +25,15 @@ const getGet = (): RequestInit => {
}

const getPost = (body: string): RequestInit => {
const headers: string[][] = [['Content-Type', jsonMimeType], ['Accept', jsonMimeType]]
const headers: Array<[string, string]> = [['Content-Type', jsonMimeType], ['Accept', jsonMimeType]]
const request = initCSRFRequest(headers)
request.method = 'POST'
request.body = body
return request
}

const getDelete = (body: string): RequestInit => {
const headers: string[][] = [['Content-Type', jsonMimeType], ['Accept', jsonMimeType]]
const headers: Array<[string, string]> = [['Content-Type', jsonMimeType], ['Accept', jsonMimeType]]
const request = initCSRFRequest(headers)
request.method = 'DELETE'
request.body = body
Expand All @@ -42,7 +42,7 @@ const getDelete = (body: string): RequestInit => {

// This currently assumes all put requests have a JSON payload and receive a JSON response.
const getPut = (body: string): RequestInit => {
const headers: string[][] = [['Content-Type', jsonMimeType], ['Accept', jsonMimeType]]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found these issues with typescript update

const headers: Array<[string, string]> = [['Content-Type', jsonMimeType], ['Accept', jsonMimeType]]
const request = initCSRFRequest(headers)
request.method = 'PUT'
request.body = body
Expand Down
Loading