일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- select
- class지우기
- vue3 props
- vue3
- javascript
- vue3emit
- 클래스지우기
- <script setup>
- nodejs
- 엑셀
- VUE
- 슬라이드기능구현
- 구글폰트다운받아사용
- 연산자
- vue 사진미리보기
- 뷰
- vueper slides
- vue이미지자르기
- vueperslides
- vue슬라이드
- 컴포넌트간 데이터보내기
- 자바변수선언
- Node
- Java
- 상위컴포넌트에서 하위컴포넌트로 데이터 전달
- vue3 데이터보내기
- 이메일유효성검사
- jsp
- 슬라이드한번에세개
- 미리보기
- Today
- Total
목록nodejs (7)
orange056
기본적으론 이렇게 2개의 파일과 1개의 폴더가 필요하다 -HTMLPage.html File Upload Commetn: File: html코드는 어려운건 없고 중요한건 enctype을 multipart/form-data로 지정해야한다는 점이다 꼬옥..! - img.js // 모듈을 추출합니다. var fs = require('fs'); var express = require('express'); var multipart = require('connect-multiparty'); // 서버를 생성합니다. var app = express(); // 미들웨어를 설정합니다. app.use(multipart({uploadDri: __dirname + '/multipart'})); // 라우터를 설정합니다. app..
// 모듈을 추출합니다. var http = require('http'); // 서버를 생성하고 실행합니다. http.createServer(function (request, response) { // 변수를 선언합니다. var date = new Date(); date.setDate(date.getDate()+7); // 쿠키를 입력합니다. response.writeHead(200, { 'Content-Type': 'text/html', 'Set-Cookie': [ 'breakfast = toast;Expires = '+ date.toUTCString(), 'dinner = chicken' ] }); // 쿠키를 출력합니다. response.end(''+ request.headers.cookie +''..
- HTMLPage.html Hello Node.js Author. RintIanTra Lorem ipsum dolor sit amet. - js 파일 // 모듈을 추출합니다. var fs = require('fs'); var http = require('http'); // 서버를 생성하고 실행합니다. http.createServer(function (request, response) { // HTML 파일을 읽습니다. fs.readFile('HTMLPage.html', function (error, data) { response.writeHead(200, {'Content-Type': 'text/html'}); response.end(data); }); }).listen(52273, function (..
- response 객체의 메서드 writeHead 응답 헤더를 작성합니다 end 응답 본문을 작성합니다 - 클라이언트에게 제공할 메시지 // 웹 서버를 생성하고 실행한다 require('http').createServer(function (request, response) { // 응답합니다. response.writeHead(200, {'Content-Type': 'text/html'}); response.end('Hello Web Server with Node.js') }).listen(52273, function () { console.log('Server Running at http://127.0.1:52273'); }); 위 코드를 실행하고 웹 브라우저( http://127.0.1:52273)..
- http 모듈에서 가장 중요한 객체이다 - http 모듈의 createServer() 메서드를 사용하면 server 객체를 생성 할 수 있다 - server 객체의 메서드 listen 서버를 실행합니다 close 서버를 종료합니다 - server 객체의 이벤트 // 모듈을 추출한다 var http = require('http'); // server 객체 생성 var server = http.createServer(); // server 객체에 이벤트 연결 server.on('request', function (code) { console.log('Request On'); }); server.on('connection', function (code) { console.log('Connection On'..
- 이벤트 연결하기 // 변수를 선언한다 var onUncaughtException = function(error){ console.log('예외발생 예외발생~!'); } // process 객체에 onUncaughtException 이벤트 연결 process.on('uncaughtException', onUncaughtException); // 2초 간격으로 예외 발생 var test = function () { setTimeout(test, 2000); error.error.error(); }; setTimeout(test, 2000); 2초마다 예외를 발생하게 했기 때문에 계속해서 예외가 발생하는 모습 예외가 발생할 경우 이벤트를 제거해주려면 아래 코드를 추가해주면 된다 process.removeL..
- 모듈이란? 기능을 쉽게 사용하고자 메서드와 속성을 미리 정의해 모아놓은 것 - module.js // 절대값을 구하는 메서드 exports.abs = function (number) { if(0 < number){ return number; }else{ return -number; } }; // 원의 넓이를 구하는 메서드 exports.circleArea = function (radius) { return radius * radius * Math.PI; }; 모듈을 생성 할 때는 exports 객체를 사용한다. 이렇게 하면 module 모듈에 abs() 메서드와 circleArea() 메서드가 생성된다. - main.js // 모듈 추출 var module = require('./module.js')..