3 글 보임 - 1 에서 3 까지 (총 3 중에서)
-
글쓴이글
-
2022년 10월 19일 00:39 #50784
이창민참가자요렇게 설치했는데 설치가 된건가욤 맨 밑에는 빨간글씨로 나옵니다 ㅠㅠ
ichangmin@ichangmin-ui-MacBookAir node.js % sudo npm install mongodb Password:
up to date, audited 112 packages in 392ms
10 packages are looking for funding run `npm fund` for details
found 0 vulnerabilities ichangmin@ichangmin-ui-MacBookAir node.js % nodemon server.js [nodemon] 2.0.20 [nodemon] to restart at any time, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: js,mjs,json [nodemon] starting `node server.js` 위이이이잉 서버 가동 ON!!!! (node:1178) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor. (Use `node --trace-warnings ...` to show where the warning was created) node:events:491 throw er; // Unhandled 'error' event ^
Error: listen EADDRINUSE: address already in use :::8080 at Server.setupListenHandle [as _listen2] (node:net:1463:16) at listenInCluster (node:net:1511:12) at Server.listen (node:net:1599:7) at Function.listen (/Users/ichangmin/Desktop/LCM/node.js/node_modules/express/lib/application.js:635:24) at /Users/ichangmin/Desktop/LCM/node.js/server.js:8:9 at /Users/ichangmin/Desktop/LCM/node.js/node_modules/mongodb/lib/utils.js:704:5 at /Users/ichangmin/Desktop/LCM/node.js/node_modules/mongodb/lib/mongo_client.js:286:7 at connectCallback (/Users/ichangmin/Desktop/LCM/node.js/node_modules/mongodb/lib/operations/connect.js:367:5) at /Users/ichangmin/Desktop/LCM/node.js/node_modules/mongodb/lib/operations/connect.js:557:5 at ReplSet.connectHandler (/Users/ichangmin/Desktop/LCM/node.js/node_modules/mongodb/lib/topologies/replset.js:337:9) Emitted 'error' event on Server instance at: at emitErrorNT (node:net:1490:8) at processTicksAndRejections (node:internal/process/task_queues:83:21) { code: 'EADDRINUSE', errno: -48, syscall: 'listen', address: '::', port: 8080 } [nodemon] app crashed - waiting for file changes before starting...
2022년 10월 19일 00:44 #50785
이창민참가자이게 server.js 코드인데 전에 강의와 코드가 겹쳐서 그런거가욤? 겹치면 안되는 코드는 어떤게 있나요 ㅠㅠ const express = require('express'); const app = express(); const bodyParser = require('body-parser'); app.use(bodyParser.urlencoded({extended : true}));
const MongoClient = require('mongodb').MongoClient; MongoClient.connect('mongodb+srv://2ckdaks:s3528022@cluster0.0qiowcf.mongodb.net/?retryWrites=true&w=majority', function(에러, client){ app.listen(8080, function(){ console.log('위이이이잉 mongoDB연결 완료') }) })
app.listen(8080, function(){ console.log('위이이이잉 서버 가동 ON!!!!'); });
//이거 중요한데 뭐시기 npm 설치안되면 앞에 sudo 붙이자 창민아 한시간 씨름할래?
// 누군가가 /pet 으로 방문을 하면 // pet 관련된 안내문을 띄워주세요
app.get('/pet', function(요청, 응답){ 응답.send('펫 쇼핑할 수있 는 페이지임'); });
//hw app.get('/beauty', function(요청, 응답){ 응답.send('뷰티용품 사세요'); })
//이런 쉬봘 ㅈ같은거 디렉터네임 앞에 언더바가 두개임 ㅈㄴ헷갈리누 ㅅㅂ app.get('/', function(요청, 응답) { 응답.sendFile(__dirname +'/index.html') });
app.get('/write', function(요청, 응답) { 응답.sendFile(__dirname +'/write.html') });
//어떤사람이 /add경로로 post요청을 하면... // ??를 해주세요 app.post('/add', function(요청, 응답){ 응답.send('전송완료') console.log(요청.body.title) console.log(요청.body.date); });
-
글쓴이글
3 글 보임 - 1 에서 3 까지 (총 3 중에서)
- 답변은 로그인 후 가능합니다.