Programming/web 관련2018. 9. 7. 16:16

timestamp 값을 UTC나 로컬시간(한국이라면 KST)로 출력하는 방법을 찾는중

단순하게 date() 객체를 이용하면 될 듯


[링크 : https://stackoverflow.com/.../how-to-convert-a-timestamp-string-to-local-time-using-javascript]

[링크 : https://stackoverflow.com/questions/6525538/convert-utc-date-time-to-local-date-time/18330682]



테스트를 위해서 브라우저의 timezone을 변경해야 하는데

linux라면  export TZ 로 간단하게 할 수 있긴한데 윈도우는 이렇다할 방법을 아직 못 찾고

대신 플러그인을 발견함.


[링크 : https://gist.github.com/dustinsmith1024/dab3560abaa62cbe0754117d44c71026

[링크 : https://chrome.google.com/.../change-timezone-time-shif/nbofeaabhknfdcpoddmfckpokmncimpj]



'Programming > web 관련' 카테고리의 다른 글

REST API HTTP 에러코드  (0) 2018.11.06
sso openid oauth  (0) 2018.09.10
li 글자 수직정렬하기  (0) 2018.08.30
user agent stylesheet  (0) 2018.08.29
div min-width  (4) 2018.08.28
Posted by 구차니
Programming/node.js2018. 9. 7. 15:40

URI나 CRUD 등의 개념이 나오는데

서버에 대해서 하나의 주소 경로로 하여 명사형으로 URI를 구성하고

GET/PUT/POST/DELETE HTTP 메소드를 이용하여

DB의 create/read(select)/update/delete를 구현한다는 것 정도로 일단 이해


[링크 : https://nesoy.github.io/articles/2017-02/REST]

[링크 : https://spoqa.github.io/2013/06/11/more-restful-interface.html]

[링크 : http://blog.remotty.com/blog/2014/01/28/lets-study-rest/]

[링크 : https://beyondj2ee.wordpress.com/2013/03/21/당신의-api가-restful-하지-않은-5가지-증거/]

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

cURL 그리고 REST  (6) 2018.09.09
node.js rtsp 스트리밍  (0) 2018.09.07
node.js jwt -JSON Web Token  (0) 2018.09.07
아직 쓸일은 없지만 걍 찾아본 node.js ssl 적용  (0) 2018.09.07
node.js exec와 JSON.parse()  (0) 2018.09.07
Posted by 구차니
Programming/node.js2018. 9. 7. 15:19
Programming/node.js2018. 9. 7. 13:44

부디(?) 이걸 쓸일이 아직 안생기길..


[링크 : https://www.securesign.kr/guides/Node-js-SSL-Certificates-Install]

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

RESTful  (0) 2018.09.07
node.js jwt -JSON Web Token  (0) 2018.09.07
node.js exec와 JSON.parse()  (0) 2018.09.07
node.js express template  (0) 2018.09.06
node.js exec()  (0) 2018.09.06
Posted by 구차니
Programming/node.js2018. 9. 7. 10:53

test.js

var exec = require('child_process').exec,

child;


child = exec("type test.txt", function(error, stdout, stderr)

{

console.log(stdout);

var obj = JSON.parse(stdout);

console.log(obj.name);

if(error !== null)

{

console.log(error);

}

}); 


test.txt

{

    "name": "식빵",

    "family": "웰시코기",

    "age": 1,

    "weight": 2.14

}


결과.. 으으 인코딩 건드리기 싫다...

아무튼 type으로 파일 내용 돌려받고(즉, 아무 명령어나 실행하고 그 결과를 받아)

JSON 포맷일 경우 파싱해서 사용가능한걸 실증!

D:\node_test>node test.js

{

    "name": "�Ļ�",

    "family": "�����ڱ�",

    "age": 1,

    "weight": 2.14

}

�Ļ� 


[링크 : http://tcpschool.com/json/json_basic_structure]

[링크 : https://www.w3schools.com/js/js_json_parse.asp]

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

node.js jwt -JSON Web Token  (0) 2018.09.07
아직 쓸일은 없지만 걍 찾아본 node.js ssl 적용  (0) 2018.09.07
node.js express template  (0) 2018.09.06
node.js exec()  (0) 2018.09.06
node.js / express/ pug(jade) 문법  (0) 2018.09.05
Posted by 구차니
Programming/node.js2018. 9. 6. 18:54

기본 템플릿은 express-generator를 통해서 만들면 되긴 하는데


C:\> npm install -g express-generator

...

+ express-generator@4.16.0

added 10 packages in 2.2s


C:\>express --ejs


  warning: option `--ejs' has been renamed to `--view=ejs'



   create : public\

   create : public\javascripts\

   create : public\images\

   create : public\stylesheets\

   create : public\stylesheets\style.css

   create : routes\

   create : routes\index.js

   create : routes\users.js

   create : views\

   create : views\error.ejs

   create : views\index.ejs

   create : app.js

   create : package.json

   create : bin\

   create : bin\www


   install dependencies:

     > npm install


   run the app:

     > SET DEBUG=node-test:* & npm start


[링크  : http://pyrasis.com/nodejs/nodejs-HOWTO]

[링크  : https://www.npmjs.com/package/express-generator]


-g는 global의 g

[링크 : http://someoneofsunrin.tistory.com/59]



app.js 에 ejs를 기본으로 삼아서 불편할 수도 있다.

// view engine setup

app.set('views', path.join(__dirname, 'views'));

app.set('view engine', 'ejs');


어쩌다 보니(?) pug를 먼저 써서
pug를 쓰려면 조금 수정을 해주어야 한다.


아무튼.. 기본 적인 소스 틀 만들기에는 express-generator가 무난해 보인다.



+

2018.09.11


$ express --view=pug myapp 

[링크 : http://expressjs.com/ko/starter/generator.html]

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

아직 쓸일은 없지만 걍 찾아본 node.js ssl 적용  (0) 2018.09.07
node.js exec와 JSON.parse()  (0) 2018.09.07
node.js exec()  (0) 2018.09.06
node.js / express/ pug(jade) 문법  (0) 2018.09.05
npm package.json  (0) 2018.09.05
Posted by 구차니
Programming/node.js2018. 9. 6. 18:45

js 라고는 해도 서버사이드로 확장되면서 서버에서는 당연히(?) 있어야 할 exec()가 추가되었다.

아무튼 exec()로 나오는 결과를 받아서 먼가 처리하는 것 까지는 해봐야 할 듯..


[링크 : https://blog.outsider.ne.kr/551]

[링크 : https://mylko72.gitbooks.io/node-js/content/chapter9/chapter9_2.html]

[링크 : https://nodejs.org/api/child_process.html]


+

2018.09.07

var exec = require('child_process').exec,

child;


child = exec("dir", function(error, stdout, stderr)

{

console.log(stdout);

if(error !== null)

{

console.log(error);

}

});


D:\node_test>node test.js

 D ����̺��� ����: �� ����

 ���� �Ϸ� ��ȣ: CCEE-4FEA


 D:\node_test ���͸�


2018-09-07  ���� 10:38    <DIR>          .

2018-09-07  ���� 10:38    <DIR>          ..

2018-09-07  ���� 10:35               195 test.js

2018-09-07  ���� 10:38                 0 test.txt

2018-09-07  ���� 10:38                 0 �� �ؽ�Ʈ ����.txt

               3�� ����                 195 ����Ʈ

               2�� ���͸�  916,882,796,544 ����Ʈ ���� 


윈도우에서 euc-kr로 받아서 그런가.. 옵션에 euc-kr encoding 해주어도 깨지는건 여전하네..

어짜피 영어로 주고 받을테니 일단 패스~ ㅠㅠ

[링크 : https://junistory.blogspot.com/2017/08/blog-post_24.html]


+

파일이 ANSI라서 보는데 이런식으로 인코딩 바꾸니 

 hild = exec("type test.txt", {encoding: 'ansi'}, function(error, stdout, stderr)


배쨴다 ㅠㅠ

D:\node_test>node test.js

<Buffer 7b 0d 0a 20 20 20 20 22 6e 61 6d 65 22 3a 20 22 bd c4 bb a7 22 2c 0d 0a 20 20 20 20 22 66 61 6d 69 6c 79 22 3a 20 22 c0 a3 bd c3 c4 da b1 e2 22 2c 0d ... > 


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

node.js exec와 JSON.parse()  (0) 2018.09.07
node.js express template  (0) 2018.09.06
node.js / express/ pug(jade) 문법  (0) 2018.09.05
npm package.json  (0) 2018.09.05
nodaemon  (0) 2018.09.04
Posted by 구차니
Programming/css2018. 9. 5. 18:54

키워드를 몰라서 헤매는중..

.class1.class2 이런식으로 정의된 css를 본적이 있어서

상속인지 어떤건지 몰라서 찾는 중..


[링크 : https://windtale.net/blog/maintainable-expandable-front-end-web-strategy/] << CSS 구조화 방법

[링크 : https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Cascade_and_inheritance]

[링크 : https://www.cmsfactory.net/node/11369]


[링크 : https://css-tricks.com/almanac/selectors/c/class/]

[링크 : https://stackoverflow.com/questions/18584015/multiple-dots-periods-in-css]

[링크 : https://stackoverflow.com/questions/14132276/html-css-what-do-elements-with-multiple-dots-mean?lq=1]

[링크 : https://css-tricks.com/multiple-class-id-selectors/]

'Programming > css' 카테고리의 다른 글

css tooltip 위치  (0) 2018.10.25
css로 백그라운드만 돌리기  (0) 2018.10.10
sass scss  (0) 2018.09.05
hover inline css  (0) 2018.08.27
css selector  (0) 2018.08.21
Posted by 구차니
Programming/css2018. 9. 5. 18:43

Syntactically Awesome StyleSheets

Sassy CSS


문법적으로 끝내주는 스타일시트, 믓진 CSS


이름은 죽이는군 ㅋㅋ

CSS의 한계를 벗어나기 위해 약간은 컴파일 하는 듯한 느낌의 무언가?


[링크 : https://sass-lang.com/]

[링크 : https://velopert.com/1712]

[링크 : https://github.com/sass/node-sass]

'Programming > css' 카테고리의 다른 글

css로 백그라운드만 돌리기  (0) 2018.10.10
css 계층 구조? 상속? 선택자 조합자?  (0) 2018.09.05
hover inline css  (0) 2018.08.27
css selector  (0) 2018.08.21
css BEM( Block Element Modifier)  (0) 2018.08.21
Posted by 구차니
Programming/node.js2018. 9. 5. 12:50

node.js 다루는데 템플릿으로 받은게 pug로 된거라 문법 찾는중

기본적으로(?) 클래스만 선언하면 무조건 div로 생성되니 조금은 고민하고 써야 할 듯


[링크 : http://jeong-pro.tistory.com/65]

[링크 : https://pugjs.org/]

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

node.js express template  (0) 2018.09.06
node.js exec()  (0) 2018.09.06
npm package.json  (0) 2018.09.05
nodaemon  (0) 2018.09.04
node.js + AJAX 테스트  (0) 2018.09.04
Posted by 구차니