inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

따라하며 배우는 노드, 리액트 시리즈 - 기본 강의

노드 리액트 기초 강의 #7 BodyParser & PostMan & 회원 가입 기능

강의 정말 감사합니다! 질문하나만 부탁드리겠습니다

275

이범진

작성한 질문수 3

0

const express = require("express");
const app = express();
const port = 5003;
const bodyParser = require("body-parser");
const { User } = require("./models/User");
//applicatioin /x-www-form -url encoded

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

const mongoose = require("mongoose");
mongoose.connect(
  "mongodb+srv://euan:abcd1234@boilerplate.tywi2.mongodb.net/<dbname>?retryWrites=true&w=majority",

  {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    useCreateIndex: true,
    useFindAndModify: false,
  }
);

app.get("/", (req, res) => {
  res.send("Hello World!");
});

app.post("/register", (req, res) => {
  const user = new User(req.body);

  user.save((err, userInfo) => {
    if (errreturn res.josn({ success: false, err });
    return res.status(200).json({
      success: ture,
    });
  });
});

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`);
});

nodejs react

답변 3

0

이범진

 아  바보.... ㅠㅠ

답변 과 좋은 강의 늘 감사하게 보고있습니다 감사합니다!!

0

John Ahn

안녕하세요 이범진님 ~  

현재 보시면 res. josn 이렇게 에러가 난다고 하는데 

res.json 으로 바꿔주세요 ^^ !! 

0

이범진

에러가

C:\Users\이범진\Documents\boiler-plate\node_modules\mongoose\lib\helpers\promiseOrCallback.js:19

            throw error;

            ^

TypeError: res.josn is not a function

    at C:\Users\이범진\Documents\boiler-plate\index.js:31:25

    at C:\Users\이범진\Documents\boiler-plate\node_modules\mongoose\lib\model.js:4832:16

    at C:\Users\이범진\Documents\boiler-plate\node_modules\mongoose\lib\helpers\promiseOrCallback.js:16:11

    at C:\Users\이범진\Documents\boiler-plate\node_modules\mongoose\lib\model.js:4855:21

    at C:\Users\이범진\Documents\boiler-plate\node_modules\mongoose\lib\model.js:494:16

    at C:\Users\이범진\Documents\boiler-plate\node_modules\kareem\index.js:246:48

    at next (C:\Users\이범진\Documents\boiler-plate\node_modules\kareem\index.js:167:27)

    at next (C:\Users\이범진\Documents\boiler-plate\node_modules\kareem\index.js:169:9)

    at Kareem.execPost (C:\Users\이범진\Documents\boiler-plate\node_modules\kareem\index.js:217:3)

    at _handleWrapError (C:\Users\이범진\Documents\boiler-plate\node_modules\kareem\index.js:245:21)

    at _cb (C:\Users\이범진\Documents\boiler-plate\node_modules\kareem\index.js:304:16)

    at C:\Users\이범진\Documents\boiler-plate\node_modules\mongoose\lib\model.js:344:9

    at C:\Users\이범진\Documents\boiler-plate\node_modules\kareem\index.js:135:16

    at processTicksAndRejections (internal/process/task_queues.js:79:11)

Emitted 'error' event on Function instance at:

    at C:\Users\이범진\Documents\boiler-plate\node_modules\mongoose\lib\model.js:4834:13

    at C:\Users\이범진\Documents\boiler-plate\node_modules\mongoose\lib\helpers\promiseOrCallback.js:16:11

    [... lines matching original stack trace ...]

    at processTicksAndRejections (internal/process/task_queues.js:79:11)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! boiler-plate@1.0.0 start: `node index.js`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the boiler-plate@1.0.0 start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\이범진\AppData\Roaming\npm-cache\_logs\2020-08-21T08_55_53_864Z-debug.log

이런식으로 나오는데 혼자 해결이 힘들어 질문드립니다 

node ,express설치확인하였고 mongodb에서 ip연결까지 확인하였으나 데이터 전송이 되지않고 있습니다 

다시한번 좋은강의 감사드립니다 !꾸벅

깃 이메일이랑 비번이 필요하다고 하네요

0

34

1

404 에러

0

101

1

34강 인증 체크에서 element 사용 때문에 에러나시는 분들 이렇게 하심 됩니다.

0

118

1

로그인, 로그아웃, 토근 작동 안 함

0

237

0

9강 오류 어떻게 해결하나요?

0

193

1

localhost 에서 연결을 거부했습니다.

0

1924

4

포스트맨에서 true가 안떠요

0

150

1

왜 안되나요

0

128

1

몽고db 연결 오류가 납니다 위에껀 입력한 코드, 아래껀 터미널이에요

0

243

1

로그아웃 401 에러(Unauthorized)

0

503

2

암호가 해싱되지 않고 입력값 그대로 db에 저장되는 문제

0

148

1

7강중에서

0

162

2

User.findByToken is not a function

0

210

1

루트 디렉토리

0

268

1

useState

0

560

1

프록시 잘 설정했는데도 404 오류 뜨는 분들

5

874

6

webpack 관련 에러 질문

0

218

1

리액트 관련 질문

0

271

1

14강 로그아웃 안됨

0

318

1

mongoDB 데이터 확인하는 법

0

408

1

postman 에러

0

290

1

선생님 리덕스를 사용하면 어떠한 부분이 좋은지 알 수 있을까요?

0

233

1

다음과 같은 에러들이 발생합니다.

0

272

1

14강 로그아웃 기능 구현시 postman에서 Cannot POST 오류가 뜹니다.

0

379

1