원문:https://www.nginx.com/blog/nginx-caching-guide/필요한 부분만 번역했습니다.The Basics (기본)A web cache sits in between a client and an “origin server”, and saves copies of all the content it sees. If a client requests content that the cache has stored, it returns the content directly without contacting the origin server. This improves performance as the web cache is closer to the client, and more efficient..
문자 복사parameter에 카피될 영억의 element가 들어간다. function copyToClipboard(element) { var $temp = $(""); $("body").append($temp); $temp.val($(element).text()).select(); document.execCommand("copy"); $temp.remove(); } 이미지 복사 출처: http://stackoverflow.com/a/40547470 html script 이미지 붙여넣기가 되는 영역에서는 이미지가 보여지고 이미지 붙여넣기가 안되는 영역에서는 alt 문장이 보여진다.
출처: http://marobiana.tistory.com/60 1. #는 쿼리가 수행될 때, 다음과 같이 된다 SELECT * FROM USER WHERE col = ? parameter : [값] ?에 bind된 값이 들어가게 된다. 이 쿼리의 컴파일 된 내용을 재사용 할 수 있고, 파라미터에 따라 대입해주므로 효율적이다.내부적으로 preparedStatement 객체에서 ? 에 들어갈 파라미터의 값을 set 해줌으로써 사용이 된다. * preparedStatement는 한번 수행한 쿼리를 캐싱하는 객체 사용 용도 >> #일 경우, 값에 사용한다. myBatis : 컬럼명 = #{값} iBatis : 컬럼명 = #값# * 쿼리에 작은 따옴표가 붙게 된다. 2. $는 쿼리가 수행될 때, 다음과 같이 된..
본문: https://coolaj86.com/articles/how-to-create-a-debian-installer.htmlWatch on YouTube: youtu.be/FY7Cx6XnpZ4 The Installer Trifecta SeriesHelloNode (example app)How to create an OSX (pkg) installer (for NodeJS apps)How to create an Ubuntu (deb) installer (for NodeJS apps)How to create a Windows (InnoSetup exe) installer (for NodeJS apps)TLDRIf you're the intelligent and impatient type:Skip down..
1. Web Server - 정의: 웹서버는 클라이언트/서버 모델과 웹의 HTTP를 사용하여 웹 페이지가 들어 있는 파일을 사용자들에게 제공하는 프로그램이다. 웹 서버는정적인 데이터 위주로 처리. WEB 서버는 HTML 문서같은 정적 컨텐츠를 처리하는 것이고 (HTTP 프로토콜을 통해 읽힐 수 있는 문서)예) Apache , IIS , NginX 등 2. WAS (Web Application )- 정의: 인터넷 상에서 HTTP를 통해 사용자 컴퓨터나 장치에 애플리케이션을 수행해 주는 미들웨어(소프트웨어 엔진)로서, Server 단에서 Application을 동작할 수 있도록 지원한다. 웹 애플리케이션 서버는 동적 서버 콘텐츠를 수행하는 것으로 일반적인 웹 서버와 구별이 되며, 주로 데이터베이스 서버와 같..
node.js, express를 사용하다가 local host에서 하던 작업을 서버에 올리니css를 가져오지 못하는 문제가 발생했다.다시 localhost에서 돌려도 너무나 잘됨이유를 찾아보니 nginx에서 static files 처리가 되지 않아서 중간에 막히는 현상이 발생 따라서 nginx 설정을 변경해주면된다.아래 코드에서 굵게 표시된 부분 upstream nodejs { server localhost:3000; } server { listen 8080; server_name localhost; root ~/workspace/test/app; location / { try_files $uri $uri/ @nodejs; } location @nodejs { proxy_redirect off; prox..
/** * NOW 1483670765299 (milliseconds) * @returns {number} */ function getNow(){ return new Date().getTime(); } /** * UTC 2017-01-06T02:46:05.299Z * @returns {string} */ function getUTCString(){ return new Date().toISOString(); } /** * LOCAL 1/6/2017, 11:46:05 AM * @returns {string} */ function getLocalTimeString(){ var now = new Date(); return now.toLocaleString(); }
원문: https://jwt.io/introduction/JWT란? JWT는 Json 객체를 이용하여 서로 다른편으로 정보를 안전하게 전달하기 위하여 자급 자족 방식으로 간결하게 정의하는 공개된 표준이다. 이러한 정보는 유효하고 신뢰될 수 있다. 왜냐하면 디지털 사인화 되었기때문이다. JWT들은 (HMAC 알고리즘을 사용하는) 암호를 사용하거나 RSA를 사용하는 퍼블릭/프라이빗 키 쌍을 이용하여 사인화 되었다. Compact 간결한 : 사이즈가 작다. JWTs은 URL이나 Post의 파라미터, 또는 HTTP 헤더 안에 포함되어 전송될 수 있다. 추가적으로 작다는것은 빠르게 전달된다는 의미가 된다. Self-contained: Payload는 사용자에 대해 모든 필수 정보를 포함하고 있어 데이터베이스 쿼리..
사용자 권한 체크를 위해서 모든 요청에 대해서 interceptor를 구현해야 한다. next() 함수를 호출하면 request를 router에게 넘겨준다. router로 보내지 않고 바로 응답을 보내려면 response로 응답을 작성해 넘기면 응답이 전송된다. (예-권한이 없다는 에러 처리) app.use(function(req, res, next) { // Interceptor next(); }); var router = express.Router(); router.use('/', index); router.use('/users', users); app.use('/v1', router); 그리고 요청에 따른 개별 interceptor를 구현하는 방법은 다음과 같다. router에서 함수를 작성할때 중..
참고 http://stackoverflow.com/a/30545872 나의 경우 Express, Postgresql 사용하여 살짝 변경함. 프로젝트 Root dir에 db.js 파일을 생성한다.나의 경우 postgresql을 사용하였기 때문에 bluebird와 pdb-pomise를 require했음. var promise = require('bluebird'); var pgp = require('pg-promise')({promiseLib: promise}); var conString = "postgres://USER:PASS@HOST/DBNAME"; var db = pgp(conString); module.exports = db; 위와 같이 하면 DB 연결은 끝DB를 사용할 파일에서 require('/..