This commit is contained in:
Primakov Alexandr Alexandrovich 2024-12-05 22:55:59 +03:00
parent 9723c825f7
commit cf2eb88662
8 changed files with 63 additions and 2881 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.env
node_modules/
dist/

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM 'node:20'
RUN mkdir -p /usr/src/app/dist
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
COPY package-lock.json /usr/src/app/
COPY dist /usr/src/app/dist
RUN npm ci --omit=dev
EXPOSE 3003
CMD [ "npm", "run", "up:prod" ]

15
docker-compose.yml Normal file
View File

@ -0,0 +1,15 @@
version: "3"
services:
bh:
# build: .
image: brojs/todo/bh:$TAG
restart: always
env_file: ./.env
ports:
- 3003:3003
environment:
- PORT=${PORT}
- JWT_SECRET=${JWT_SECRET}
- MONGO_CONNECT_URL=${MONGO_CONNECT_URL}

2900
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,17 +14,13 @@
"dependencies": {
"dotenv": "^16.4.5",
"express": "^5.0.1",
"express-json-validator-middleware": "^3.0.1",
"install": "^0.13.0",
"jsonwebtoken": "^9.0.2",
"mongoose": "^8.8.3",
"npm": "^10.9.1",
"pbkdf2-password": "^1.2.1",
"ts-node": "^10.9.2"
"pbkdf2-password": "^1.2.1"
},
"devDependencies": {
"@types/express": "^5.0.0",
"nodemon": "^3.1.7",
"ts-node": "^10.9.2",
"ts-node-dev": "^2.0.0",
"typescript": "^5.7.2"
}

View File

@ -21,7 +21,7 @@ export const connect = async () => {
});
lists.forEach(async (list) => {
await (list as unknown as any).addItem(item._id);
await (list as unknown as any).addItem(item);
})
}

View File

@ -59,7 +59,7 @@ router.post('/:listId/item', async (req, res) => {
description
});
await (list as any).addItem(item._id);
await (list as any).addItem(item);
res.send(item)
})

View File

@ -1,5 +1,4 @@
import { Router } from "express";
import { Validator } from "express-json-validator-middleware";
import bkfd2Password from "pbkdf2-password";
import jwt from 'jsonwebtoken'
@ -11,8 +10,6 @@ const hasher = bkfd2Password();
export const router = Router();
const { validate } = new Validator({});
const user = {
type: "object",
required: ["name"],