- 준비
ddp 라이브러리 추가
$ meteor add ddp - 외부 DDP 연결
extDDP = DDP.connect("http://externalhost.com:4100"); - Collection 연결
Posts = new Mongo.Collection('posts', extDDP);
2,3 과정은 client 에서 가장 먼저 실행되도록 client/lib 디렉토리 안에 넣는 것을 추천 - 기존 연결을 외부 DDP로 대치
Meteor.connection = extDDP;
ex) 활용예
Meteor.connection = extDDP;
Meteor.loginWithPassword(login.valiu, password.value);
Meteor.startup 같은 곳에서 사용하면 좋음.
만일 login을 그냥 사용하려면
expDDP.call('login', .... ); 형태로 사용하여야함. - Subscribe 사용
onCreated 시점에 this.subscribe 대신 DDP 객체의 subscribe를 사용
Template.postView.onCreated(function() {
extDDP.subscribe("getPosts", { searchWord: 'blahblah' });
}); - Helper 사용
3번처럼 했다면 그냥 똑같이 사용
Tempalte.postView.helpers({
"posts": function() {
return Posts.find({});
}
}); - Method 사용
Template.postInput.events({
"submit": function(e) {
expDDP.call('addPost', inputText.value', function(error, result) {
/* do something */
});
e.preventDefault();
}
});
주로 쓰는 컴터들이 죄다 리모트로만 연결해서 iSH나 Termux 같은 모바일 터미널에서 간단하게 개발환경을 쓰고 싶었음. 사실 vi (vim 도 아님) 으로 충분하지만 avante.nvim 이라는 녀석이 Cursor 처럼 외부 LLM 모델을 쓸 수 있다고 해서 삽질을 시작함;;; macOS 에서야 대충해도 되니 약간 삽질이 필요했던 windows 기준으로 기록. NeoVim 설치 https://winstall.app/apps/Neovim.Neovim winget 이 별도로 설치 없이 쓸 수 있는 package manager 라서 간단하게 winget install --id=Neovim.Neovim -e 로 끝나는 점이 좋았음. LazyVim 설치 https://www.lazyvim.org/installation 보고 Powershell 로 설치. 깔끔하다! 생각보다 빠르다! nvim-treesitter 관련 오류 수정 시작할 때 마다 nvim-treesitter 에서 오류 발생. 실행 속도도 느려지고 매우 불편! 다행스럽게도 reddit 에서 해결법을 알려줌. https://www.reddit.com/r/neovim/comments/14oozmu/neovim_cant_find_c_compiler/ choco install mingw refreshenv 관리자모드에서 mingw 를 설치하고 (winget 으로는 설치 안되는 듯?) refreshenv 하니 해결. 필요한 외부 유틸들 설치 https://www.nerdfonts.com/font-downloads Nerdfonts 설치. ligature를 쓰고 싶어 FiraCode Nerd Font를 선택. ripgrep , fd 도 설치. search & replace 를 편하게 쓸 수 있다. :, esc 눌렀을 때 모달 팝업 같은 UI가 나와서 당황. https://www.youtube.com/wat...
댓글
댓글 쓰기