inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

174만명의 커뮤니티!! 함께 토론해봐요.

Cannot read properties of undefined (reading 'Op') 문제를 도와주시면 감사하겠습니다

해결됨

[리뉴얼] Node.js 교과서 - 기본부터 프로젝트 실습까지

선생님 안녕하세요 선생님의 sns 예제 코드에서 app.js에서 아래의 소스코드를 추가해봤습니다 그런데, 구글링을 해봤는데도 에러가 해결이 안되어서 가르쳐주시면 정말 감사하겠습니다 app.js 소스코드입니다 const express = require('express'); const cookieParser = require('cookie-parser'); const morgan = require('morgan'); const path = require('path'); const session = require('express-session'); const nunjucks = require('nunjucks'); const dotenv = require('dotenv'); const passport = require('passport'); dotenv.config(); const pageRouter = require('./routes/page'); const authRouter = require('./routes/auth'); const postRouter = require('./routes/post'); const userRouter = require('./routes/user'); const { sequelize } = require('./models'); const { User,Sequelize:{Op} } = require('./models'); const passportConfig = require('./passport'); const app = express(); passportConfig(); // 패스포트 설정 app.set('port', process.env.PORT || 8001); app.set('view engine', 'html'); nunjucks.configure('views', { express: app, watch: true, }); sequelize.sync({ force: false }) .then(() => { console.log('데이터베이스 연결 성공'); }) .catch((err) => { console.error(err); }); app.use(morgan('dev')); app.use(express.static(path.join(__dirname, 'public'))); app.use('/img', express.static(path.join(__dirname, 'uploads'))); app.use(express.json()); app.use(express.urlencoded({ extended: false })); app.use(cookieParser(process.env.COOKIE_SECRET)); app.use(session({ resave: false, saveUninitialized: false, secret: process.env.COOKIE_SECRET, cookie: { httpOnly: true, secure: false, }, })); app.use(passport.initialize()); app.use(passport.session()); app.use('/', pageRouter); app.use('/auth', authRouter); app.use('/post', postRouter); app.use('/user', userRouter); User.find({ attribute: ['email', 'nick'], where: {id: {[Op.in]: [1,2]}} }).then((data)=>{ console.log(JSON.stringify(data)) }); app.use((req, res, next) => { const error = new Error(`${req.method} ${req.url} 라우터가 없습니다.`); error.status = 404; next(error); }); app.use((err, req, res, next) => { res.locals.message = err.message; res.locals.error = process.env.NODE_ENV !== 'production' ? err : {}; res.status(err.status || 500); res.render('error'); }); app.listen(app.get('port'), () => { console.log(app.get('port'), '번 포트에서 대기중'); }); user.js 소스코드입니다 const Sequelize = require('sequelize'); module.exports = class User extends Sequelize.Model { static init(sequelize) { return super.init({ email: { type: Sequelize.STRING(40), allowNull: true, unique: true, }, nick: { type: Sequelize.STRING(15), allowNull: false, }, password: { type: Sequelize.STRING(100), allowNull: true, }, provider: { type: Sequelize.STRING(10), allowNull: false, defaultValue: 'local', }, snsId: { type: Sequelize.STRING(30), allowNull: true, }, }, { sequelize, timestamps: true, underscored: false, modelName: 'User', tableName: 'users', paranoid: false, charset: 'utf8', collate: 'utf8_general_ci', }); } static associate(db) { db.User.hasMany(db.Post); db.User.belongsToMany(db.User, { foreignKey: 'followingId', as: 'Followers', through: 'Follow', }); db.User.belongsToMany(db.User, { foreignKey: 'followerId', as: 'Followings', through: 'Follow', }); } }; index.js 소스코드입니다 const Sequelize = require('sequelize'); const env = process.env.NODE_ENV || 'development'; const config = require('../config/config')[env]; const User = require('./user'); const Post = require('./post'); const Hashtag = require('./hashtag'); const db = {}; const sequelize = new Sequelize( config.database, config.username, config.password, config, ); db.sequelize = sequelize; db.User = User; db.Post = Post; db.Hashtag = Hashtag; User.init(sequelize); Post.init(sequelize); Hashtag.init(sequelize); User.associate(db); Post.associate(db); Hashtag.associate(db); module.exports = db; 읽어주셔서 감사합니다

  • Sequelize
  • mysql
  • mongodb
  • nodejs
Like me black 댓글 1 좋아요 0 조회수 531

오류가 발생했습니다.

미해결

처음 배우는 리액트 네이티브

따라서 진행을했는데 채팅을 쳐도 화면에 남아있지않고 또 console에 avatar부분에 강의처럼 링크가 나오지도 않습니다ㅠ 깃허브는 : https://github.com/Dong-Seung-hyeon/rn-Login 이것입니다.

  • react-native
  • javascript
승현 댓글 1 좋아요 0 조회수 185

앱 종료시 "DB 이미 꺼짐" 오류에 대하여

해결됨

[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발

현재까지 작성한 모든 API는 정상적으로 작동합니다. 다만 앱을 종료할 때 오류가 나더군요. org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-212] 그래서 약간의 찜찜함(?)이 남아있는데 어떻게 하면 해결할 수 있을까요? 참고로 저의 application.yml의 내용은 다음과 같습니다. spring : main : allow-bean-definition-overriding : true jpa : show-sql : true hibernate : ddl-auto : create-drop defer-datasource-initialization : true # data.sql 이 hibernate 보다 먼저 실행되지 않도록 지연 datasource : url : jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE h2 : console : enabled : true

  • rest-api
  • spring-boot
포근포근한 수달 댓글 1 좋아요 1 조회수 2739

git 권한 요청 드립니다.

미해결

Vue.js + TypeScript 완벽 가이드

감사합니다.

  • typescript
  • vuejs
댓글 1 좋아요 1 조회수 191

while문 세미콜론

해결됨

더 자바, Java 8

while (spliterator.tryAdvance(System. out ::println)) ; 위 코드처럼 세미콜론으로 끝내는 것은 언제 사용할 수 있는 문법인가요? 처음 보는거라 보면서 굉장히 당황했네요

  • java
정성훈 댓글 1 좋아요 0 조회수 464

socketIO Room 설정하는 부분

미해결

Slack 클론 코딩[실시간 채팅 with React]

namespace는 workspace이고, room은 channel로 두신 것 같은데, front에서 특정 room에 들어가는 코드가 없는 것 같은데 이에 대해서 혹시 설명 부탁 드릴 수 있을까요? namespace까지는 useSocket이용해서 연결하는데, room 관련해서 계속 찾아보는데 강의에서 못본것 같아서 물어봅니다.

  • react
  • 웹팩
  • Socket.io
  • babel
  • typescript
  • 클론코딩
NoobDev 댓글 2 좋아요 0 조회수 561

actual 관련 Error Catch 부분.

미해결

견고한 JS 소프트웨어 만들기

안녕하세요 수업중 궁금한 부분이 있어 글을 남깁니다. actual 이라는 함수로 만들어서 바로 error 를 만드는 것이 아니고 ClickCountView.js 에서 throw Error 를 해야지만 오류가 발생하는 건가요? 설명상으로 이해 하면 actual 라는 함수로 바로 error 를 만들어내는 걸로 이해를 했는데요 !.

  • tdd
김주현 댓글 1 좋아요 0 조회수 252

'java.lang.Integer' in your configuration.

미해결

[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발

질문 Consider defining a bean of type 'java.lang.Integer' in your configuration. 위와같은 에러가 발생합니다. 검색을 해봐서 해당하는 자료를 참고해서 고칠려고했는데 잘 모르겠네요 ㅎㅎ ^^;;

  • spring-boot
  • rest-api
SJ 댓글 1 좋아요 0 조회수 206

회원 유효성 검사에 AOP 를 적용해도 될까요?

미해결

스프링 핵심 원리 - 고급편

안녕하세요 강사님 AOP 를 배우니, 개인 프로젝트에 적용하고 싶은 생각이 들어 질문을 드립니다. 현재 게시판 서비스를 개발중입니다. 이 때 탈퇴한 회원의 글 이나, 숨김 처리된 글 은 화면단에서 보이지 않도록, 게시글 조회 API 마다 "필터 로직" 을 중복 하여 사용하고 있습니다. 그렇다 보니, api 마다 중복되는 필터 로직을 AOP 로 대체할 수 있지 않을까 생각이 들었습니다. 학습 자료를 보니 "오류 검사 및 처리, 동기화, 성능 최적화, 모니터링/로깅" 에 AOP 가 사용된다고 적혀있는데, 제가 구현하고자하는 필터링 로직도 AOP 를 적용하는 것이 적절한지 궁금하여 질문 드립니다 감사합니다 ! 회원의 유효성 검사라는 횡단 관심사의 문제는 충족하지만, 이를 DB 단이 아닌 AOP 를 적용하여 해결하는 것이 적절한 방법인지에 대한 궁금증이라 생각해주시면 감사하겠습니다 :))

  • spring
  • 디자인-패턴
류돌프 댓글 1 좋아요 2 조회수 502

리엑트 쿼리 버전 질문!

미해결

[리뉴얼] React로 NodeBird SNS 만들기

안녕하세요 제로초님 리엑트쿼리 버전을 보면서 궁금한것이 있어 질문드립니다. 1. _app.tsx의 코드에서 const queryClientRef = useRef < QueryClient >(); if ( ! queryClientRef . current ) { queryClientRef . current = new QueryClient (); 리엑트쿼리 공식문서에선 useState를 사용하였고 제로초님 코드에서 Ref를 사용하였던데 ref 사용하신이유가 렌더링관련해서 더나은 이점이 있을거라 추측했는데 어떤건가요!? 2. getServerSideProps에서 리엑트쿼리로 비동기 값을 로드하고서 같은 쿼리키로 사용한 데이터를 콘솔로그 찍었을때 맨첨에 undefined로 찍혀서 질문드립니다. 제가 생각했을때는 서버에서 데이터를 로드하고서 쿼리키에 저장시키니까 코드를 사용하는 로직에서 같은 쿼리키의 데이터를 콘솔로그 찎으면 값이 채워져 있어야한다고 생각하는데 제가 코드를 잘못짠건지 아니면 이해를 잘못한건지 궁금합니다. 해당 데이터가 서버에서 로드됬는지 확인할수 있는 방법이 있을까요? 3. props: {dehydratedState: JSON.parse(JSON.stringify(dehydrate(queryClient))), getServerSideProps의 로직에서 dehydrate(queryClient)를 JSON.parse(JSON.stringify)로 묶으신 이유가 무엇인지 궁금합니다 감사합니다

  • react-query
  • Next.js
  • redux
  • react
  • express
  • nodejs
박재호 댓글 1 좋아요 0 조회수 387

on/off 버튼 질문

미해결

따라하며 배우는 리액트 테스트 [2023.11 업데이트]

현재 테스트 코드 같은 경우에는 on -> off 로 변했을때 각 버튼이 disabled가 되는지를 확인하고 그에 맞는 코드를 작성하는데요. off인 상태에서 on이 됬을 경우에도 테스트하려면 render(<App/>) 후에 disabled 상태를 만들어 줘야 하는데 이 경우의 테스트 코드는 어떻게 작성해야 하나요?

  • 웹앱
  • React-Context
  • react
  • jest
jeus0630 댓글 1 좋아요 0 조회수 294

사용자 디렉터리 관련 문의 입니다 - ㅎㅎ

미해결

리눅스 입문 - 개념으로 탄탄히!!

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 안녕하세요. 강의 잘 듣고 있습니다. john 이라는 계정 생성 후 /etc/passwd 로 john 계정 확인해보니 home/john 경로에 지정이 되어있다고 나오는데, 막상 home 디렉토리 이하에는 test 밖에 었습니다. home 아래에 test와 john 2개다 있어야 하는게 아닌지 문의드려요.

  • 사용자
  • linux
itboxer91 댓글 1 좋아요 0 조회수 237

리덕스 데브툴즈에 액션기록이 안됩니다. ㅠㅠ

미해결

[리뉴얼] React로 NodeBird SNS 만들기

안녕하세요. 강의대로 다 따라했는데 run 한 후에 로그인/로그아웃 해도 리덕스데브툴즈에 액션기록이 안됩니다. 왜그런걸까요? 그리고, 최초 로딩시에 콘솔에서 아래와 같은 오류도 발생하는데 이건 무슨문제일까요? ㅠㅠ

  • Next.js
  • nodejs
  • redux
  • react
  • express
플레어 댓글 2 좋아요 0 조회수 550

[html] post를 이용하여 값이 담긴 변수를 넘겨주려면 input을 어떻게 설정해야하나요?

미해결

{{url_for('static' , filename = transfer_img)}} 로 생긴 변수 transfer_img 를 post를 이용해 다른 페이지로 전달하고 싶습니다. 그래서 <form align = "center" action = "/custom_case" method = "POST" enctype = "multipart/form-data" > <p class = "text-black-50 mb-0" align = "center" > <input type = "hidden" , name = "b_transfer_image" value = {{ transfer_img }}> <a href = "/custom_case" > custom case </a> </p> </form> 를 이용해 value 값을 저렇게 설정해줬는데 저렇게 설정하는 것이 맞나요? value에 그냥 transfer_img를 적어도 에러가 나서 여쭤봅니다.

힘드렁 댓글 0 좋아요 0 조회수 145

user-service.yml의 username / password 바뀌었을 때 h2-console 접속 관련

미해결

Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)

안녕하세요. 강사님 강의 잘 듣고 있습니다~ 따라 하면서 해보고 싶은 게 있었는데 잘 안되서 방법이 있는지 질문드려요. 해보고 싶었던 거는 user-service.yml의 값들이 바뀌었을 떄 actuator/refresh 하여 바뀐 정보로 업데이트하고 바뀐 정보로 접속해 보고 싶었는데 안되더라고요. username을 바꿨을 때 refresh 로 POST 요청하면 username이 바뀌었다고 응답이 오는데 password는 문자열이라 그런지 바뀌었다고 바뀌었다고 응답도 안 오더라고요. 그래서 username으로 테스트 해봤는데, username을 다른 걸로 바꾸고 refresh 하고 바뀐 username으로 접속해도 안 되고 이전 username으로 접속은 되더라고요. 혹시 이런 경우에 가능케 하는 방법이 있을까요?

  • architecture
  • JPA
  • spring-boot
  • spring-cloud
  • Kafka
  • msa
tree 댓글 1 좋아요 0 조회수 405

html에서 post를 사용하여 input에 담아 넘겨준 value 값을 파이썬에서 받아 쓰려면 어떻게 정의하고 써야하나요?

미해결

웹페이지를 만들기 위해 flask 사용 중입니다. bst_post.html에서 <img class = 'nst_img' src = "{{url_for('static' , filename = transfer_img)}}" > 위의 코드 중, 값이 담긴 변수 transfer_img를 <form align = "center" action = "/custom_case" method = "POST" enctype = "multipart/form-data" > <p class = "text-black-50 mb-0" align = "center" > <input type = "hidden" , name = "b_transfer_image" value = {{ transfer_img }}> <a href = "/custom_case" > custom case </a> </p> </form> 을 이용해 __init__.py의 @ app.route ( '/bst_post' ) def case_get (): return render_template( 'case.html' ) @ app.route ( '/custom_case' , methods = [ 'GET' , 'POST' ]) def case_post (): if request.method == "POST" : return render_template( 'case.html' , transfer_img) 라는 코드로 받아왔는데요, 마지막 줄 transfer_img 에 빨간 줄이 그이면서 에러가 났습니다. html에서 넘긴 input 의 value 값을 어떻게 받아와야하나요?

힘드렁 댓글 0 좋아요 0 조회수 361

117강 구조체를 정의하여 ShipData 구성

미해결

유니티(Unity)로 시작하는 게임개발: Part 3. 슈팅게임 개발

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. ShipData 구조체의 코드는 아래와 같습니다. public int id; public float base_dmg; public string name; public string kName; public ShipData(int id, float baseDmg, string name, string kName) { this.id = id; t his.base_dmg = baseDmg; this.name = name; this.kName = kName; } 생성자로 매개변수를 받아서 각각의 데이터에 저장할거면 변수를 왜 굳이 public으로 선언할까요? 위의 구조체를 사용하는 코드에서는 for (int i = 1; i < lines.Length-1; i++) { string[] row = lines[i].Split('\t'); ships[i - 1].id = int.Parse(row[0]); ships[i - 1].base_dmg = float.Parse(row[1]); ships[i - 1].name = row[2]; ships[i - 1].kName = row[3]; } 이렇게 직접 접근하기 위해서는 위의 코드처럼 public 이어야 가능할것 같아요. 그런데 생성자에서 매개변수를 받는 다는 의미는 위의 for문에서 ships[i - 1] = new ShipData(int.Parse(row[0]), float.Parse(row[1]), row[2], row[3]); 구조체의 데이터를 은닉하고 위와같은 식으로 사용하겠다는 뜻이 아닌가요? 어떤쪽으로 사용해도 동작에는 이상없으나 이제 원리를 깨우치는 입장에서 여러 배운 내용들이 겹치며 의도가 약간 헷갈리고 있어서 질문해 봅니다.

  • C#
  • unity
최성호 댓글 0 좋아요 0 조회수 249

혹시 코드 포멧터 어떤거 사용하시는지 알 수 있을까요?

미해결

실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발

강의와 관련이 없는 질문일 수도 있는데,, 영한님이 사용하시는 코드 포멧터가 있으실까요? 제가 vscode + JS 만 써봐서 prettier 같은 코드 포멧터가 있는지 궁금합니다. 구글링을 해보니 단축키로 자동 정렬하는 내용이 제일 많은데.. 따로 스크립트를 등록해서 사용하고 계신가요?

  • JPA
  • java
  • spring
  • 웹앱
  • spring-boot
ydg0330 댓글 1 좋아요 0 조회수 291

eslint관련 질문드려요

미해결

[리뉴얼] React로 NodeBird SNS 만들기

강의를 들으면서 일단은 실습을 그대로 진행했는데 eslint설정 이후 아래와 같은 오류가 children에서 발생하더라고요 에러발생 이유와 해결방법에 대해서 알 수 있을까요? 그리고 추가로 해당강의에서 vscode를 사용하면 eslint를 따로 학습해서 추가로 적용해야한다고 하셨는데 만약 적용을 안하고 수업에서 제로초님이 설명한대로만 하면 이후 수업에 진도를 나가는데 있어 문제가 될까요?

  • redux
  • nodejs
  • express
  • react
  • Next.js
댓글 1 좋아요 0 조회수 228

Why Cash App Temporarily Locked My Account?

미해결

Have problems using the Cash App? It's okay, but you should know that you're not alone. A lot of people face this locked cash app account issue at one point or another. Here are some tips to help you fix the problem. First, if you have an active credit card, link it to your cash app account. If you don't have an active credit card, link it to another bank account. Then, if you&rsquo;re Cash App account locked , log in and follow the instructions provided in the help section. If you&rsquo;re why Cash App temporarily locked my account , the first thing you should do is to contact the company. They will contact you and ask you for your registered details. If you're not sure what your registered information is, you can provide it to the company. If you don't know your social security number, give it to them. They will send you an email to verify your account. Next, you must open the link on your device. If you have a mobile phone, you can open your account again. You can also request a review from the cash app's executives. Typically, you'll need to wait twenty-four to forty-eight hours for the process to complete. This process can be frustrating, but it's worth the wait. It's possible to unlock your account again. There are many ways to get your account back. How to Unlock Cash App Account? Once you have downloaded the Cash App, you must log in with your social security number or government-issued ID. Once you have registered for a Cash App account, it will be locked. If this happens, you should contact the Cash App executives and get your account back. During the verification process, they will ask for your registered details and additional information such as your social security number or email address. You may also receive an email with a verification form. You will have to open the link to complete the verification process. If you have locked your Cash App account , you can still unlock it. First, you must contact the customer support team and verify your identity. If you have a mobile phone, you can connect to the service. The customer support representatives will verify your identity and send you a link to complete a verification process. Once you've verified your identity, you can proceed to use your Cash App account. You can use it for any purpose you like, as long as you're not violating the terms and conditions of the app. To unlock your Cash App account , go to the Login screen and click on the profile icon. You will then be prompted to enter your email address or phone number. Once you've entered these details, you can follow the instructions that appear. You can also use the same method to unlock your bank account Can someone hack your Cash App with your email? If you've ever been in a situation where you have been robbed of your cash, then you know how frightening it can be. You've been using Cash App to process all of your salary deposits and payments, but a hacker has taken your account. Naturally, you don't want this to happen to you. After all, your money is important, and it's hard to live without it. Hackers love Cash App. People have had their stocks, bitcoin, and money stolen. Squareup, which runs through the app, has also had problems with can someone hack your cash app with your email . Unfortunately, Cash App offers little help to users. These scammers often use email, text messages, and social media to lure unsuspecting users into giving them their personal information. And if you're worried that someone might try to hack your account, don't worry. We've listed some ways to protect you to avoid the situation of Cash App account hacked with your email : Keeping your information safe is key. Hackers don't need much else to access your account, but they do need your email address and your Cash App Pin. If your Cash App account is stolen, it won't be easy to recover. It's crucial to protect your account from being stolen and keep it safe. You don't want to lose your money, so ensure that your personal information is secure.

  • cashappaccountlocked
bella mercy 댓글 0 좋아요 0 조회수 178

인기 태그

인프런 TOP Writers

주간 인기글