Programming/node.js2019. 3. 20. 18:54

squid 프록시 설정 만지다가 빡쳐서

어짜피 프록시 HTTP 서버라던가 이런걸텐데 그럼 단순(?)하게

HTTP 서버로 구성해서 해당 URL을 파싱 해서

로컬 캐시에 없으면 요청하고 저장후 전달해주면 되는거 아냐? 라는 생각에 검색해보니 똭!


[링크 : https://www.npmjs.com/package/caching-proxy]


'Programming > node.js' 카테고리의 다른 글

https proxy using node.js  (0) 2019.03.27
node.js unit test  (0) 2019.03.25
node.js 사용자 모듈 만들기  (0) 2019.03.13
ckeditor 와 php, node.js 연동  (0) 2019.03.11
floala 에디터 + node.js  (0) 2019.03.08
Posted by 구차니
Programming/node.js2019. 3. 13. 13:47

전에 적었나? 기억 안나니 다시 씀


express를 쓰다 보면 가장 마지막 줄에

module.exports = router; 

요런게 보이는데 모듈로 정의해주는 녀석이다.


여러가지 방법들이 보이는데, 취향대로 쓰면 될 듯

(개인적으로는 작성하고 모듈로 변환하는 쪽이라서 가장 아래꺼를 주로 쓰게 될 듯)

export.func_name = function () {}


module.exports = {

   funcname : function() {}

};


function funcname() {};

module.exports = {

   funcname : funcname

}; 


[링크 : https://hongku.tistory.com/92]

[링크 : https://winmargo.tistory.com/173] DAO

[링크 : https://jiwondh.github.io/2017/01/17/create-module/]

[링크 : https://doitnow-man.tistory.com/161]

'Programming > node.js' 카테고리의 다른 글

node.js unit test  (0) 2019.03.25
node.js http cache proxy  (0) 2019.03.20
ckeditor 와 php, node.js 연동  (0) 2019.03.11
floala 에디터 + node.js  (0) 2019.03.08
wysiwyg editor / node.js  (0) 2019.02.26
Posted by 구차니
Programming/node.js2019. 3. 11. 14:56

form에서 method을 지정할때 post로 하고

node.js에서 받아서 처리하게 하는 것도 방법일 듯


CKEDITOR.replace('contents');

CKEDITOR.instances.contents.updateElement(); 

[링크 : https://offbyone.tistory.com/207]

[링크 : https://academy.realm.io/kr/posts/realm-node-js-express-blog-tutorial/]


+

2019.03.14


아무생각없이 복붙했는데 안되서 찾아보니 replace에 들어가는 id를 넣어주어야 한다 -_ㅠ

두가지 모두 ckeditor v4에서 작동하는 것을 확인하였으니 골라서 입맛대로 쓰면 될 듯

(위에꺼는 updatElement 해주고 form으로 넘겨주거나 해당 내용을 받아오면 되는 지라 원칙에 가까운 느낌?)

var editor = CKEDITOR.replace( 'editor1' );

var data = CKEDITOR.instances.editor1.getData(); 


[링크 : https://ckeditor.com/docs/ckeditor4/latest/guide/dev_savedata.html]

'Programming > node.js' 카테고리의 다른 글

node.js http cache proxy  (0) 2019.03.20
node.js 사용자 모듈 만들기  (0) 2019.03.13
floala 에디터 + node.js  (0) 2019.03.08
wysiwyg editor / node.js  (0) 2019.02.26
node.js 파비콘 설정하기  (0) 2019.02.22
Posted by 구차니
Programming/node.js2019. 3. 8. 10:56

node.js랑 그래도 작동하는건 확인했는데..

임시 파일이 어디로 갔는지 모르겠네?


아래 링크는 파일 / 이미지 / 동영상 세파트로 나누어져 있으니 참고

(index.html 파일 내용도 조금씩 다르니 주의)

[링크 : https://www.froala.com/wysiwyg-editor/docs/server/nodejs/file-upload]


+

일단은 이녀석.. localhost를 제외하면 라이센스 경고를 띄운다.

쓰는건 보류!

'Programming > node.js' 카테고리의 다른 글

node.js 사용자 모듈 만들기  (0) 2019.03.13
ckeditor 와 php, node.js 연동  (0) 2019.03.11
wysiwyg editor / node.js  (0) 2019.02.26
node.js 파비콘 설정하기  (0) 2019.02.22
node.js apache 스타일 로그  (0) 2019.02.22
Posted by 구차니
Programming/node.js2019. 2. 26. 07:47

많이 쓰는 에디터는 다 존재하는데

굳이 패키지 쓸 이유가 있나 싶다.. 걍 CDN에서 받아 쓰는게 나을텐데..


[링크 : https://www.npmjs.com/package/ckeditor]

[링크 : https://www.npmjs.com/package/tinymce]

'Programming > node.js' 카테고리의 다른 글

ckeditor 와 php, node.js 연동  (0) 2019.03.11
floala 에디터 + node.js  (0) 2019.03.08
node.js 파비콘 설정하기  (0) 2019.02.22
node.js apache 스타일 로그  (0) 2019.02.22
express ejs  (0) 2019.02.20
Posted by 구차니
Programming/node.js2019. 2. 22. 10:51

찾아보니 이상한(?) 모듈들 쓰는데

걍 귀찮아서 express 템플릿으로 만들었을 경우

/public/favicon.ico 넣어주면 끝

(크롬이나 edge 브라우저에서 테스트 완료)


[링크 : https://zinlee.tistory.com/entry/nodejs에서-파비콘favicon-설정-방법]

'Programming > node.js' 카테고리의 다른 글

floala 에디터 + node.js  (0) 2019.03.08
wysiwyg editor / node.js  (0) 2019.02.26
node.js apache 스타일 로그  (0) 2019.02.22
express ejs  (0) 2019.02.20
pug include / ejs include  (0) 2019.02.20
Posted by 구차니
Programming/node.js2019. 2. 22. 10:47

이것저것 찾다가 그냥 express 엔진에서 제공하는거 있길래

그걸 변형해서 사용함

github에서는 morgan 이라는 이름으로 쓰는데

express --ejs로 생성한 템플릿에 적용하려니 logger라는 이름으로 있어서 그걸 사용하여 추가함

(당연히?) 해당 프로젝트의 /log 디렉토리를 생성하여 주어야 한다.

(파일은 자동 생성됨)


var logger = require('morgan');
var fs = require('fs')
var path = require('path')

var app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

var accessLogStream = fs.createWriteStream(path.join(__dirname, 'log/access.log'), { flags: 'a' })
app.use(logger('dev'));
app.use(logger('combined', { stream: accessLogStream }))

[링크 : https://github.com/expressjs/morgan]


+

[링크 : https://www.npmjs.com/package/access-log]

[링크 : https://www.npmjs.com/package/apache-log2]


+

2019.02.23


일단은 webalizer를 통해서 정상적으로 로그 수집이 되는 것을 확인했음

'Programming > node.js' 카테고리의 다른 글

wysiwyg editor / node.js  (0) 2019.02.26
node.js 파비콘 설정하기  (0) 2019.02.22
express ejs  (0) 2019.02.20
pug include / ejs include  (0) 2019.02.20
node_modules include  (0) 2019.01.29
Posted by 구차니
Programming/node.js2019. 2. 20. 19:13

express 엔진의 기본값으로 보이는 ejs는 왜 도움말이 없냐..

문법들좀 보려고 하는데 도움을 안주네


그러고 보니. pug도 새로운(?) 문법으로 보였는데

ejs는 html과 동일하지만 실제로는 렌더링 언어였던 거니까

결국에는 pug 보다는 성능이 좀 나을지 몰라도 여전히 static page로 간주하진 않는다고 봐야하려나?

[링크 : https://www.npmjs.com/package/ejs]

'Programming > node.js' 카테고리의 다른 글

node.js 파비콘 설정하기  (0) 2019.02.22
node.js apache 스타일 로그  (0) 2019.02.22
pug include / ejs include  (0) 2019.02.20
node_modules include  (0) 2019.01.29
npm npx yarn bower  (0) 2019.01.28
Posted by 구차니
Programming/node.js2019. 2. 20. 18:59

pug대신 ejs를 써보는데

문득 무슨차이가 있나 궁금해지네..


둘다 include는 지원한다. 정도만 확인인가.. ㅠㅠ

[링크 : https://pugjs.org/language/includes.html]

[링크 : https://stackoverflow.com/questions/5404830/node-js-ejs-including-a-partial]

'Programming > node.js' 카테고리의 다른 글

node.js apache 스타일 로그  (0) 2019.02.22
express ejs  (0) 2019.02.20
node_modules include  (0) 2019.01.29
npm npx yarn bower  (0) 2019.01.28
node-red rpi 접속  (0) 2018.12.20
Posted by 구차니
Programming/node.js2019. 1. 29. 19:07

node.js에서 이런저런 패키지 깔고 보면

node_modules/패키지 안에 각종 js 파일들이 존재한다.


그걸 끌어올 방법이 없나 하고 찾아보는데

대개는 static으로 해당 모듈의 경로를 지정하고 script 태그에서 끌어다 쓰라는데 영 깔끔한 방법은 아닌 듯..


[링크 : https://julie.io/writing/javascript-node-modules/]

[링크 : https://stackoverflow.com/.../how-to-include-scripts-located-inside-the-node-modules-folder]


[링크 : https://dontkry.com/posts/code/using-npm-on-the-client-side.html]

[링크 : https://forum.vuejs.org/t/include-css-js-assets-from-node-modules-in-index-html/3956/2]

[링크 : https://www.npmjs.com/package/jquery]



+

react.js 예제를 보다 개발자 도구로 보니 은근 node_modules가 보이는걸 발견..

딱히 잘못된 접근은 또 아닌건가?

'Programming > node.js' 카테고리의 다른 글

express ejs  (0) 2019.02.20
pug include / ejs include  (0) 2019.02.20
npm npx yarn bower  (0) 2019.01.28
node-red rpi 접속  (0) 2018.12.20
node-red 자동시작 관련  (0) 2018.12.14
Posted by 구차니