Posts
Q&A
๋ก๊ทธ์ธ ๊ธฐ๋ฅ ํ์ธ ์ค postman sending request ๋ฌดํ๋ก๋ฉ
ํ๋ฒ ์ฐพ์๋ณด๋ ์๋ ๋ถ๋ถ์์ ์ผ๋จ success : fasle ๋ถ๋ถ ์คํ์ธ๊ฒ๊ฐ์ต๋๋ค success : false๋ก ๋ฐ๊ฟ์ฃผ์๊ฒ ์ด์ ? app.post('/register', (req, res) => { // ํ์๊ฐ์ ํ ๋ ํ์ํ ์ ๋ณด๋ฅผ client์์ ๊ฐ์ ธ์ด const user = new User(req.body) // ๊ฐ์ ธ์จ ์ ๋ณด๋ฅผ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ ์ฅ user.save((err, userInfo) => { if (err) return res.json({ success: fasle, err }) return res.status(200).json({ success: true }) }) })
- 0
- 1
- 585
Q&A
MongoParseError: options usecreateindex, usefindandmodify are not supported
์ด๋ ๊ฒ ์ ๋ ฅํด์ค๋ ๊ด์ฐฎ์๊น์ ? mongoose.connect(URI, { useNewUrlParser : true, useUnifiedTopology : true, }) .then(()=> console.log(`MongoDB connected`)) .catch(err => console.log(err))
- 17
- 3
- 581
Q&A
ํ๊ฒฝ๋ณ์๊ฐ ์ ์ ๋๋ก ์๋จนํ๊ฒ๊ฐ์ฃ ?
๋ค ์๋ ํ์ธ์. ๋จผ์ ํด๋น ์ฝ๋ ์๋จ์ ์ด๋ ๊ฒ config๋ฅผ ๋ฐ์์๊ตฌ์. import { ConfigModule } from '@nestjs/config'; ์๋๋ main.ts ์ ๋๋ค. import { ValidationPipe } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { HttpExceptionFilter } from './common/exceptions/http-exception.filter'; async function bootstrap() { const app = await NestFactory.create(AppModule); app.useGlobalPipes(new ValidationPipe()); // class validation ์ฌ์ฉ app.useGlobalFilters(new HttpExceptionFilter()); const PORT = process.env.PORT; await app.listen(PORT); } bootstrap(); ์๋๋ pakage.json์ ๋๋ค. "dependencies": { "@nestjs/common": "^7.6.15", "@nestjs/config": "^0.6.3", "@nestjs/core": "^7.6.15", "@nestjs/mongoose": "^7.2.4", "@nestjs/platform-express": "^7.6.15", "bcrypt": "^5.0.1", "class-transformer": "^0.4.0", "class-validator": "^0.13.1", "mongoose": "^5.12.15", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.2", "rxjs": "^6.6.6" }, "devDependencies": { "@nestjs/cli": "^7.6.0", "@nestjs/schematics": "^7.3.0", "@nestjs/testing": "^7.6.15", "@types/express": "^4.17.11", "@types/jest": "^26.0.22", "@types/node": "^14.14.36", "@types/supertest": "^2.0.10", "@typescript-eslint/eslint-plugin": "^4.19.0", "@typescript-eslint/parser": "^4.19.0", "eslint": "^7.22.0", "eslint-config-prettier": "^8.1.0", "eslint-plugin-prettier": "^3.3.1", "jest": "^26.6.3", "prettier": "^2.2.1", "supertest": "^6.1.3", "ts-jest": "^26.5.4", "ts-loader": "^8.0.18", "ts-node": "^9.1.1", "tsconfig-paths": "^3.9.0", "typescript": "^4.2.3" }, nestJS/config๊ฐ ์๋ค๋๊ฒ ํ์ธ์ด ๋๊ณ .. ``` MONGODB_URI = "mongodb+srv://:@nestcluster.wwcon.mongodb.net/myFirstDatabase?retryWrites=true&w=majority" PORT = 3000 MODE='dev' ``` .env ํ์ผ์ ๋๋ค.
- 1
- 2
- 587
Q&A
npm start ํน์ npm run start๋ฅผ ์น๋ฉด ์๊พธ ์๋์ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ํ๋ฉ๋๋ค.
์.. ์ค๋์ ๋๋ฉ๋๋ค..ใ ใ ์ด๊ฒ ์ด์ฐ๋์๋ฌธ์ธ๊ฑฐ์ง...... ์๋ฌ๋ฌ๋ ์ํฉ์ ์น์ 3 nestJS์ค์นํ Helloworld ๋์ฐ๊ธฐ์๋๋ฐ ๋ง์ํ์ ์์๋๋ก ์ค์นํ๊ณ ๋๋ค npm start ๋ฅผ ํ๋๋ฐ ์๋ฒ๊ฐ ๋์ํ๊ธฐ๋ณด๋จ ์์๊ฐ์ ์๋ฌ๋ฅผ ํ์ํ์์ต๋๋ค. ๊ทธ๋ฐ๋ฐ ์ค๋์ ๊ทธ๋ฅ npm start๋ฅผ ํ๋๋ฐ ๋ฌ๋ค์... ์๋ npm run start:dev๋ก ํด์ค์ผํ๋๊ฑธ๊น์?
- 1
- 3
- 1.5K
Q&A
์๋ ํ์ธ์ ์ ๋ก์ด๋ ํ์ต์๊ดํ ๊ฐ๋จํ ์๋ด๋ถํ๋๋ฆฝ๋๋ค.
๊ฐ์ฌํฉ๋๋ค! ใ ใ ใ
- 0
- 2
- 361