Javascript/node.js 4

node.js - jade, express-generator (210226)

node.js 웹사이트 구현 서버구현 express 미들웨어 내부 외부 템플리트 처리 html + data ... 공유기 웹페이지 해킹 Express-generator 사이트의 frame + 템플리트 처리 ejs => gugudan => login session cookie cookie-parser * pug( => jade ) https://jade-lang.com jade 설치 mkdir jade1 cd jade1/ npm init -y npm install express npm install jade (npm 업데이트가 필요한 경우) npm install -q npm@7.6.0 // server.js "use strict"; const express = require( 'express' ); con..

Javascript/node.js 2021.02.26

node.js - express, route, ejs (210225)

* 애플리케이션 서버(구형) jsp - model2 * 내장 웹서버 (최신) es - express 1. 서버 시작법 const express = require( 'express' ); //console.log( express ); const app = express(); app.listen( 3000, () => { console.log( '3000번 포트에서 요청 대기 중 ...' ); }); 2. 컨트롤러 -> 라우팅 app.all( '경로', ( req, res ) => { res.send( '' ); }); app.get / post( '경로', ( req, res ) => { res.send( '' ); }); url 주소에서 ? : 문자 존재하거나 생략 + : 1번이상 반복 * : 임의의 문..

Javascript/node.js 2021.02.25

node.js - http, express (210224)

nodejs http client = 브라우저 기능 = 크롤링(스크래핑) 1. ajax / 로그인 (o) phantomjs + setTimeout getElementById 2. ajax / 로그인 (x) urllib / axios *dom 처리 string cheerio http server = tomcat + servlet 1. http.createServer().listen(포트번호) 2. let parseUrl = new URL( req.url ); parseUrl.pathname = ?? 3. post / get => framework 새로 작업할 폴더를 생성 mkdir httpex2 cd httpex2 npm init -y mkdir public_html touch public_html/gug..

Javascript/node.js 2021.02.24

node.js - phantomjs, http (210223)

node - 스크래핑( 크롤링 ) - html과 결합됨 http client urllib -> axios html, xml, json striptags cheerio … *PhantomJS / Selenium = ajax로 가져오는 내용을 추출 https://phantomjs.org http server - webserver(tomcat) socket http / http2 phantom 설치하기 mkdir phantomex1 cd phantomex1 su - root mkdir /usr/local/phantom cd /usr/local/phantom wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar...

Javascript/node.js 2021.02.23