웹프로그래밍 (130) 썸네일형 리스트형 [node.js] express cookie-parser Installation $ npm install cookie-parser API var express = require('express') var cookieParser = require('cookie-parser') var app = express() app.use(cookieParser()) cookieParser(secret, options) secret a string used for signing cookies. This is optional and if not specified, will not parse signed cookies. options an object that is passed to cookie.parse as the second option. See cookie for more.. [node.js] Check synchronously if file/directory exists in Node.js http://stackoverflow.com/questions/4482686/check-synchronously-if-file-directory-exists-in-node-js [node.js] file upload Server.js /*Define dependencies.*/ var express=require("express"); var multer = require('multer'); var app=express(); var done=false; /*Configure the multer.*/ app.use(multer({ dest: './uploads/', rename: function (fieldname, filename) { return filename+Date.now(); }, onFileUploadStart: function (file) { console.log(file.originalname + ' is starting ...') }, onFileUploadComplete: function (file).. [node.js] bodyParser deprecated http://stackoverflow.com/questions/24330014/bodyparser-is-deprecated-express-4 express/connect top-level generic This example demonstrates adding a generic JSON and URL-encoded parser as a top-level middleware, which will parse the bodies of all incoming requests. This is the simplest setup. var express = require('express') var bodyParser = require('body-parser') var app = express() // parse app.. [node.js] .router' is deprecated! 위 오류가 날때... app.router 를 use 하는 라인을 지워주면 된다. 예전에는 넣어줘야되는데 최신버젼에선 없어졌다고 한다. Eclipse 에서 Dynamic Web Project, context root 를 / 로 변경 - Project Explorer 뷰 - Project 선택 - Properties - Web Project Settings - Context root 를 / 로 변경 - 메뉴 - Project - Clean - Servers 뷰에서 tomcat 선택, + 펼침, 해당 프로젝트 선택 후 삭제 - Servers 뷰에서 tomcat 선택 - 마우스 우클릭, Clean - Servers 뷰에서 tomcat 선택 - 마우스 우클릭, Add and Remove - 해당 프로젝트 선택후 Add Javascript iBook EPUB 3.0 Images not working iBook 에서 이미지를 클릭 했을때 동적으로 div를 생성하고 그 안에 background-image 스타일 지정을 해주었으나 도통 빈 칸만 뜨고 이미지가 출력되지 않았다. 콘솔로그를 찍어볼 수 없는 거지같은 테스트환경이어서 html 마크업으로 일일히 확인해본 결과 이미지를 불러올때 ibooksimg:// 라는 프로토콜을 사용해야 하지만 ibooks:// 로 불러오면서 이미지가 출력되지 않은 것이었다. var str = $("img").get(0).src; str = str.replace("ibooks://", "ibooksimg://"); 로 간단히 replace 치환처리 하니 정상 출력되었다. jQuery $("img").load non-cache 이미지의 원본 크기를 구하기 위해서 $("img").get(0).naturalWidth 이나 naturalHeight 를 변수에 초기화했을때, 0 값이 떨어진다. 이러한 현상을 막기 위해서 $("img").load(function(){ var img = { width:$(this).get(0).naturalWidth, height:$(this).get(0).naturalHeight }); 등으로 사용할 수 있다. 그런데 여기서 load 된 값이 캐슁처리되면서 더이상 load가 실행되지 않는다. 이때 아래와 같은 방법으로 대응가능하다. $("img").one("load",function(){ var img = { width:$(this).get(0).naturalWidth, height:$(this).ge.. 이전 1 ··· 8 9 10 11 12 13 14 ··· 17 다음