2018. 1. 31. 14:30

미티어 하다가, 표에 번호를 순서대로 넣고 싶은데....


 No

이름 

핸드폰 

 1

 김기리

010-222-5356 

 2

 홍길동 

010-123-4562 

 3

 장나라 

010-535-5526 


디비에는 이름이랑 번호만 저장되어있고,


뿌려줄때, 번호를 붙여줘야하는데,


미티어에서는 each 안에 {{@index}}라고 번호가 순서대로 붙는다.


하지만, 0 부터 시작해서, 0,1,2,3 이렇게 시작을 하니까.


1부터 하려면, 펑션을 이용해서, index번호에 1을 더해서 붙여줘야 한다.



HTML 에서 작업

1
2
3
4
5
6
7
8
    <tbody>
      {{#each list}}
      <tr>
        <td>{{offset @index}}</td>
        {{>addressItem}}
      </tr>
      {{/each}}
    </tbody>
cs



js파일에서 helpers에 펑션을 넣어준다.

1
2
3
4
5
6
7
Template.addressList.helpers({
      "offset" : function(index){
            index +=1;
            return index;
      }    
});
 
cs

  


참고 사항으로, 나같은경우는 처음에 each 안에 템플릿을 불러왔었다.


{{> addressItem}} 불러오고, 


addressItem안에 tr>td가 있어서, 그곳에 @index를 넣었는데, 계속 에러가 뜨는거다.


근데, 미티어 같은 경우는 최하위부터 위로 올라가기때문에,


each전에 2뎁스로 내려가는 테이블에 @index를 넣으면 얘가 못찾는거다.


그래서 아에 index붙이는 <td>를 each있는 템플릿으로 올려버렸다.


이방법이 아니면, 인자값으로 계산에서, 전달하는 방식을 쓰라는데, 그것까지는 안했고, 


밑에 링크만 추가해 놓겠다.


http://blazejs.org/api/templates.html#Template-dynamic





Posted by Tyson
2018. 1. 31. 12:27

Meteor 테스트할때, 개발자모드 콘솔에서 바꿔서 바로 실행하고 싶을때,


이건 데이터 샘플 넣을때 쓰는 메소드 불러와서 넣을때 하는법


Meteor.call("메소드명", 입력값, 결과값처리);


Meteor.call("makeFixtureData",Meteor.userId(),function(err,result){console.log(result);});



또는 세션을 변경해서 보고 싶을때는


Session.set("cnt", 30);


Session.set(세션명, 입력값);


이런식으로 실행하면 바로 바뀌는것을 볼수있다.

Posted by Tyson
2018. 1. 30. 11:27

집에 컴터에서 작업하던거, 


서버에 띄어서 하고 싶어서,


깃헙에서 가져와서 meteor run를 하는데, 계속 서버가 멈추고, 작업이 안되는거다.


에러가 뜨길래, 보니까, 보니까, 


깃허브에는 모듈들이 없이 소스만 있기때문이다.


그래서, npm를 설치해줘야한다.


폴더에서, 


#> git clone https://github.com/tyson444/meteorStudy.git


git clone 깃허브주소. 위에꺼는 내꺼다.


그리고 폴더들을 보면, node폴더등이 없다.


#> cd meteorStudy               <<meteorStudy 폴더로 이동

#> meteor npm install            << npm설치, 모듈등이 설치된다.

#> meteor run 이러면 뜨는것을 확인할수있다.




Posted by Tyson
2018. 1. 26. 17:22


1. 파일을 다운 받아서 압축을 풀어준다.


https://www.phusionpassenger.com/library/walkthroughs/start/meteor.html


위 링크로 가서 다운 받고, 


서버에 올려준다음에 압축을 푼다.


tar -xzvf passenger-X.X.X.tar.gz -C /somewhere-permanent



2. Ruby를 설치해준다.


yum install -y ruby rubygem-rake



3. PATH에 추가해준다.

압축 푼 폴더의 /bin폴더를 추가해준다.


>>  PATH=$PATH:/root/passenger-5.1.12/bin



나 같은 경우는 그냥 root폴더의 passenger-5.1.12에 압축을 풀었기 때문에 저기에 해줬다.


4. 인스톨해준다.


passenger-config validate-install
 * Checking whether this Phusion Passenger install is in PATH... ✓
 * Checking whether there are no other Phusion Passenger installations... ✓


설치할때, 

[root@ip bin]# ./passenger-config validate-install

What would you like to validate?

Use <space> to select.

If the menu doesn't display correctly, press '!'


 ‣ ⬢  Passenger itself

   ⬡  Apache


-------------------------------------------------------------------------


위 같은 문구가 나오는데, 


방향키로 움직이면, 위에 검은점이 바뀌고, 스페이스를 누르면, 선택할수있다.


난 passenger만 선택한다음에 엔터를 쳤다.


그러면, 


-------------------------------------------------------------------------


 * Checking whether this Passenger install is in PATH... ✓

 * Checking whether there are no other Passenger installations... ✓


Everything looks good. :-)


위 같이 뜨고, 


passenger라고 써보면, 

아래와 같이 뜬다....드디어 설치됬다.

[root@ip bin]# passenger

Phusion Passenger Standalone, the easiest way to run web apps.


Available commands:


  passenger start      Start Phusion Passenger Standalone.

  passenger stop       Stop a Phusion Passenger instance.

  passenger status     Show the status of a running Phusion Passenger instance.


Run 'passenger <COMMAND> --help' for more information about each command.




아..사이트 가면, 우분트, 레드헷, 선택해서 설치방법볼수있는데, 


계속.yum를 써서 설치하려는데, 계속 repo 에러가 떠서,  결국 기타os설치법으로 했다.









Posted by Tyson
2018. 1. 25. 11:49

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[root@meteor]# meteor run
 
You are attempting to run Meteor as the 'root' superuser. If you are developing, this is almost certainly
*not* what you want to do and will likely result in incorrect file permissions. However, if you are
running this command in a build process (CI, etc.), or you are absolutely sure you know what you are
doing, set the METEOR_ALLOW_SUPERUSER environment variable or pass --allow-superuser to proceed.
 
Even with METEOR_ALLOW_SUPERUSER or --allow-superuser, permissions in your app directory will be incorrect
if you ever attempt to perform any Meteor tasks as a normal user. If you need to fix your permissions, run
the following command from the root of your project:
 
  sudo chown -Rh <username> .meteor/local
 
[root@meteor]# meteor run --allow-superuser
 
Even with METEOR_ALLOW_SUPERUSER or --allow-superuser, permissions in your app directory will be incorrect
if you ever attempt to perform any Meteor tasks as a normal user. If you need to fix your permissions, run
the following command from the root of your project:
 
  sudo chown -Rh <username> .meteor/local
 
[[[[[ /var/www/html/meteor ]]]]]         
 
=> Started proxy.                             
=> Started MongoDB.                           
=> Started your app.                          
 
=> App running at: http://localhost:3000/
cs


meteor run 하면 되는데, root계정일때는 알림이 뜬다.


그래서 

meteor run --allow-superuser

라고 써줘야 한다.


그러면 http://localhost:3000/


로 접속하라고 뜨는데, 접속이 안되는거다.


그래서 보니까, 


아마존서버 보안그룹에서 포트를 열어줘야한다.


AWS로 들어가서,


NETWORK&Security에서 '보안그룹'으로 들어가서, 


아래와 같이 추가해준다.


보안 그룹: sg-ebac5e9f
설명
인바운드
아웃바운드
태그
유형
프로토콜
포트 범위
소스
설명
HTTP
TCP
80
0.0.0.0/0
HTTP
TCP
80
::/0
SSH
TCP
22
0.0.0.0/0
SSH
TCP
22
::/0
사용자 지정 TCP 규칙
TCP
3000
0.0.0.0/0
사용자 지정 TCP 규칙
TCP
3000
::/0

























그러면 접속이 된다.








위 같은 화면이 뜨고, 버튼를 누를때마다 숫자가 올라간다.

























Posted by Tyson
2018. 1. 23. 17:27

Meteor 설치하기


$curl https://install.meteor.com/ | sh 


하면 자동설치이다.


프로젝트 생성


>meteor create 프로젝트명

>meteor create testProcject


쓰면 끝이다.


근데, 이런 에러가 뜰때가 있다.


npm ERR! code ENOGIT

npm ERR! No git binary found in $PATH

npm ERR! 

npm ERR! Failed using git.

npm ERR! Please check if you have git installed and in your PATH.



이건 git이 설치 안되어서 그런거라...

git을 설치해 줘야한다.


> yum install git 
으로 git을 설치해준다.



루트로 작업 할시 


You are attempting to run Meteor as the 'root' superuser. If you are developing, this is almost certainly

*not* what you want to do and will likely result in incorrect file permissions. However, if you are

running this command in a build process (CI, etc.), or you are absolutely sure you know what you are

doing, set the METEOR_ALLOW_SUPERUSER environment variable or pass --allow-superuser to proceed.


Even with METEOR_ALLOW_SUPERUSER or --allow-superuser, permissions in your app directory will be incorrect

if you ever attempt to perform any Meteor tasks as a normal user. If you need to fix your permissions, run

the following command from the root of your project:


  sudo chown -Rh <username> .meteor/local


이런 문구가 나올수 있다. 


슈퍼유저로 하지 말라는 이야기인데, 


그래도 root로 작업하려면,


meteor create metcongress --allow-superuser


이렇게 해주면 생성할수있다.


Posted by Tyson