Compare commits

..

No commits in common. "add3197d65326181fe78f8ac6ab80e9136e1d682" and "9f0506f52647d90247de276444ef4768002e7f07" have entirely different histories.

2 changed files with 99 additions and 5 deletions

View file

@ -1,4 +1,4 @@
FROM node:18 as backend-ts-compiler FROM node:16 as backend-ts-compiler
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
COPY tsconfig*.json ./ COPY tsconfig*.json ./
@ -6,23 +6,23 @@ RUN npm install
COPY . . COPY . .
RUN npm run build RUN npm run build
FROM node:18 as frontend-compiler FROM node:16 as frontend-compiler
WORKDIR /app/frontend WORKDIR /app/frontend
COPY --from=backend-ts-compiler /app/frontend/package*.json ./ COPY --from=backend-ts-compiler /app/frontend/package*.json ./
RUN npm install RUN npm install
COPY --from=backend-ts-compiler /app/frontend/ ./ COPY --from=backend-ts-compiler /app/frontend/ ./
RUN npm run build RUN npm run build
FROM node:18 as strip-dev-deps FROM node:16 as strip-dev-deps
WORKDIR /app WORKDIR /app
COPY --from=backend-ts-compiler /app/package*.json ./ COPY --from=backend-ts-compiler /app/package*.json ./
COPY --from=backend-ts-compiler /app/dist ./ COPY --from=backend-ts-compiler /app/dist ./
RUN npm install --only=production RUN npm install --only=production
FROM node:18 FROM node:16
WORKDIR /app WORKDIR /app
COPY --from=strip-dev-deps /app ./ COPY --from=strip-dev-deps /app ./
COPY --from=frontend-compiler /app/frontend/public ./frontend/public COPY --from=frontend-compiler /app/frontend/public ./frontend/public
RUN echo "JWT_SECRET=$(openssl rand -base64 256 | tr -d '\n')" > .env RUN echo "JWT_SECRET=$(openssl rand -base64 256 | tr -d '\n')" > .env
USER node USER node
CMD [ "/bin/sh", "-c", "node index.js" ] CMD [ "/bin/sh", "-c", "node index.js db-init && node index.js" ]

94
test.rest Normal file
View file

@ -0,0 +1,94 @@
POST http://localhost:3000/api/v1/users/register HTTP/1.1
content-type: application/json
{
"username": "another user",
"password": "234234234"
}
###
POST http://localhost:3000/api/v1/users/login HTTP/1.1
content-type: application/json
{
"username": "another user",
"password": "234234234"
}
###
GET http://localhost:3000/api/v1/users/self HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwNDA4NTQ1LCJleHAiOjE2NTA1ODEzNDV9.DCt_IpukPaihSGl1N8a5ve5pd75N4aePxR4YKzw98Ss
###
POST http://localhost:3000/api/v1/channels HTTP/1.1
content-type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwNDA4NTQ1LCJleHAiOjE2NTA1ODEzNDV9.DCt_IpukPaihSGl1N8a5ve5pd75N4aePxR4YKzw98Ss
{
"name": "channel 4"
}
###
PUT http://localhost:3000/api/v1/channels/7 HTTP/1.1
content-type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwNDA4NTQ1LCJleHAiOjE2NTA1ODEzNDV9.DCt_IpukPaihSGl1N8a5ve5pd75N4aePxR4YKzw98Ss
#Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjQ5MjU5NDUwLCJleHAiOjE2NDk0MzIyNTB9.JmF9NujFZnln7A-ynNpeyayGBqmR5poAyACYV6RnSQY
{
"name": "modified channel 2"
}
###
DELETE http://localhost:3000/api/v1/channels/9 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwNDA4NTQ1LCJleHAiOjE2NTA1ODEzNDV9.DCt_IpukPaihSGl1N8a5ve5pd75N4aePxR4YKzw98Ss
#Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidHlwZSI6MSwiaWF0IjoxNjQ5MjU5NDUwLCJleHAiOjE2NDk0MzIyNTB9.JmF9NujFZnln7A-ynNpeyayGBqmR5poAyACYV6RnSQY
###
GET http://localhost:3000/api/v1/channels/1 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwNDA4NTQ1LCJleHAiOjE2NTA1ODEzNDV9.DCt_IpukPaihSGl1N8a5ve5pd75N4aePxR4YKzw98Ss
###
GET http://localhost:3000/api/v1/channels HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwNDA4NTQ1LCJleHAiOjE2NTA1ODEzNDV9.DCt_IpukPaihSGl1N8a5ve5pd75N4aePxR4YKzw98Ss
###
POST http://localhost:3000/api/v1/channels/1/messages HTTP/1.1
content-type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwNDA4NTQ1LCJleHAiOjE2NTA1ODEzNDV9.DCt_IpukPaihSGl1N8a5ve5pd75N4aePxR4YKzw98Ss
{
"content": "i love cheese"
}
###
GET http://localhost:3000/api/v1/channels/6/messages HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwNDA4NTQ1LCJleHAiOjE2NTA1ODEzNDV9.DCt_IpukPaihSGl1N8a5ve5pd75N4aePxR4YKzw98Ss
###
PUT http://localhost:3000/api/v1/messages/3 HTTP/1.1
content-type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwNDA4NTQ1LCJleHAiOjE2NTA1ODEzNDV9.DCt_IpukPaihSGl1N8a5ve5pd75N4aePxR4YKzw98Ss
{
"content": "hello again!"
}
###
GET http://localhost:3000/api/v1/messages/3
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwNDA4NTQ1LCJleHAiOjE2NTA1ODEzNDV9.DCt_IpukPaihSGl1N8a5ve5pd75N4aePxR4YKzw98Ss
###
DELETE http://localhost:3000/api/v1/messages/2 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidHlwZSI6MSwiaWF0IjoxNjUwNDA4NTQ1LCJleHAiOjE2NTA1ODEzNDV9.DCt_IpukPaihSGl1N8a5ve5pd75N4aePxR4YKzw98Ss