landingpage에서 useEffect로 fetchProducts를 하고 있는데, VSCode development server를 켜놓고 하지 않습니까? 근데 vscode에서 save를 할 때 landingpage의 useEffect가 실행되는데, 이게 원래 이런건가요? useEffect는 컴포넌트가 처음 마운트 될 때만 실행되는 것으로 알고 있는데, 개발모드에서 save할 때는 save할 때마다 실행되나요? 궁금하네요.
npm -v , node -v 로 버전 확인 후 package.json의 engine에서 node, npm 버전 수정 파이썬을 설치. - 설치시 ADD PATH 인가에 체크 packge.json > dependencies에서 bcrypt 삭제 npm install 설치 후 bcryptjs 추가 설치 npm install bcryptjs --save
logout할 때, server로 요청을 보내서 authUser middleware를 통과하도록 하는 이유? handleLogout function에서 local storage의 accessToken을 삭제시키고, store의 user 정보만 initial state, 그리고 isAuth 등을 false로 바꾸면 그만일텐데, 왜 server에 요청을 보내는 과정이 필요할까요!?
질문 있어서 남깁니다. 메인페이지에서 Link를 타고 upload, list 들어가서 화면이 로드 돼야하는데 돼지 않고 하얀바탕으로 돼면서 Error표시 없이 No routes matched location "/list" Error Component Stack가 표시 됍니다. 어떤문제이고 해결 방법이 무엇인지 궁금합니다. Ps. 질문이 이해 안가실것 같아서 스샷 올려놨습니다.
왜 이러는지 알 수 있을까요? 찾아봐도 모르겠습니다... '-webkit-text-size-adjust' is not supported by Chrome, Chrome Android, Edge 79+, Firefox, Safari. Add 'text-size-adjust' to support Chrome 54+, Chrome Android 54+, Edge 79+.
안녕하세요. 강의를 듣고 있는 고등학생입니다. 학교 프로젝트로 강의 하천이나 수질을 나타내는 지도 서비스를 만들려고 하는데 강의 길이에 따라 마커의 크기를 바꾸고 강의 수질에 따라 마커의 색을 바꾸고 싶습니다. css 파일 자체에서 index.js에서 선언된 변수에 따라 마커의 크기를 바꿀 수는 없나요??
#!/usr/bin/env node /** * Module dependencies. */ var app = require('../app'); var debug = require('debug')('suzil:server'); var http = require('http'); const mongoose = require("mongoose"); const userConfig = require("../config/userConfig.json"); let db = mongoose.connection; db.on("error",console.error); db.once("open",()=>{ console.log("Connected to mongo Server"); }); mongoose.connect( `mongodb+srv://wiyuchan1021:${userConfig.PW}>@suzilo.i1je5.mongodb.net/suzilo?retryWrites=true&w=majority`, {useNewUrlParser: true, useUnifiedTopology: true} ) /** * Get port from environment and store in Express. */ var port = normalizePort(process.env.PORT || '3000'); app.set('port', port); /**f * Create HTTP server. */ var server = http.createServer(app); /** * Listen on provided port, on all network interfaces. */ server.listen(port); server.on('error', onError); server.on('listening', onListening); /** * Normalize a port into a number, string, or false. */ function normalizePort(val) { var port = parseInt(val, 10); if (isNaN(port)) { // named pipe return val; } if (port >= 0) { // port number return port; } return false; } /** * Event listener for HTTP server "error" event. */ function onError(error) { if (error.syscall !== 'listen') { throw error; } var bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port; // handle specific listen errors with friendly messages switch (error.code) { case 'EACCES': console.error(bind + ' requires elevated privileges'); process.exit(1); break; case 'EADDRINUSE': console.error(bind + ' is already in use'); process.exit(1); break; default: throw error; } } /** * Event listener for HTTP server "listening" event. */ function onListening() { var addr = server.address(); var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port; debug('Listening on ' + bind); } 코드 실행하면 PS C:\Users\yuchan\suzil> npm start > suzil@0.0.0 start > nodemon ./bin/www [nodemon] 3.1.7 [nodemon] to restart at any time, enter rs [nodemon] watching path(s): . [nodemon] watching extensions: js,mjs,cjs,json [nodemon] starting node ./bin/www (node:13580) [MONGODB DRIVER] Warning: useNewUrlParser is a deprecated option: useNewUrlParser has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version (Use node --trace-warnings ... to show where the warning was created) (node:13580) [MONGODB DRIVER] Warning: useUnifiedTopology is a deprecated option: useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version MongoServerError: bad auth : authentication failed at Connection.sendCommand (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connection.js:289:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Connection.command (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connection.js:312:26) at async continueScramConversation (C:\Users\yuchan\node_modules\mongodb\lib\cmap\auth\scram.js:131:15) at async executeScram (C:\Users\yuchan\node_modules\mongodb\lib\cmap\auth\scram.js:80:5) at async ScramSHA1.auth (C:\Users\yuchan\node_modules\mongodb\lib\cmap\auth\scram.js:39:16) at async performInitialHandshake (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connect.js:104:13) at async connect (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connect.js:24:9) { errorResponse: { ok: 0, errmsg: 'bad auth : authentication failed', code: 8000, codeName: 'AtlasError' }, ok: 0, code: 8000, codeName: 'AtlasError', connectionGeneration: 0, [Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' } } node:internal/process/promises:391 triggerUncaughtException(err, true /* fromPromise */); ^ MongoServerError: bad auth : authentication failed at Connection.sendCommand (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connection.js:289:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Connection.command (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connection.js:312:26) at async continueScramConversation (C:\Users\yuchan\node_modules\mongodb\lib\cmap\auth\scram.js:131:15) at async executeScram (C:\Users\yuchan\node_modules\mongodb\lib\cmap\auth\scram.js:80:5) at async ScramSHA1.auth (C:\Users\yuchan\node_modules\mongodb\lib\cmap\auth\scram.js:39:16) at async performInitialHandshake (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connect.js:104:13) at async connect (C:\Users\yuchan\node_modules\mongodb\lib\cmap\connect.js:24:9) { errorResponse: { ok: 0, errmsg: 'bad auth : authentication failed', code: 8000, codeName: 'AtlasError' }, ok: 0, code: 8000, codeName: 'AtlasError', connectionGeneration: 0, [Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' } } Node.js v20.17.0 [nodemon] app crashed - waiting for file changes before starting... 이러한 오류가 터미널에 뜨는데 왜 그런걸까요?
사물인터넷 통신은 내 손에 (Arduino, MQTT, Nodejs, MongoDB, Android,VS Code)
Drivers를 선택해서 나온 url주소로도 MongoDB for VS Code를 선택해서 나온 url주소로도 접속이 실패합니다. Node.js 코드는 다음과 같이 작성했습니다. const mongoose = require("mongoose"); const MONGODB_URL = "mongodb+srv://root:1234@education.sidnf.mongodb.net/"; mongoose .connect(MONGODB_URL) .then(() => console.log("Connected to database!")) .catch(() => console.log("Connection failed...")) Connection failed... 라고 나옵니다. Network Access에서도 0.0.0.0으로도 해보고, 제 컴퓨터의 IP주소로도 해보았습니다. 전부 접속 실패가 뜹니다. 이유를 알 수 있을까요?!
몽고디비에 회원가입하고, 이제 js코드를 작성해(vscode에서) 몽고디비에서 데이터베이스 및 컬렉션을 생성시키는 과정을 따라가고 있었습니다. 강의 내용과 동일한 구조를 가지고 있고, 코드 작성은 똑같이 index.js에서 진행했습니다. (또 패키지를 확인해본 결과 몽고디비는 잘 설치되어 있었구요) const express = require("express"); const MongoClient = require("mongodb").MongoClient; const app = express(); const port = 5000; const MongoURL= "mongodb+srv://아이디:비밀번호@chaehyun.f26fr.mongodb.net/Express?retryWrites=true&w=majority&appName=Chaehyun"; var db, post; app.use(express.static("public")) app.use(express.urlencoded({extended: false})) //app.set( 'view engine' , 'pug' ) app.set('view engine' , 'ejs' ) app.get("/", (req, res) => { post.insertOne({ 제목 : "test", 내용 : "test", 날짜 : new Date(), }) res.render("index") }); app.post('/calculator', function(req,res){ let result = Number(req.body.num1) + Number(req.body.num2); res.render("result", {result:result}) }) app.all("*", function(req,res){ res.status(404).send("찾을 수 없는 페이지") }) MongoClient.connect(MongoURL, (err, database) => { if(err){ console.log(err); return; } else{ app.listen(port, () => { console.log(`Example app listening on port ${port}`); }); db = database.db("Express"); post = db.collection("posts") } }) 이처럼 입력하였는데 몽고디비에선 데이터베이스와 컬렉션이 생성되지 않습니다... 그런데 수업에선 localhost:5000 을 통해 -> 몽고디비의 데이터베이스 생성을 하시는 듯 해 보였습니다만, 애초에 app.get( )에서의 내용 때문에 웹사이트는 작동되지 않는게 맞지 않나요...?