본문 바로가기
  • AI (Artificial Intelligence)

Programming/JavaScript, Node.js35

Public, Private, and Protected Scope in JavaScript Ref. https://www.stevethedev.com/blog/programming/public-private-and-protected-scope-javascript Posted by Steven Jimenez in Programming on Apr 08, 2018 Of the features that has always been painfully missing from JavaScript, one of the most impactful is the conspicuous inability to use the public, private, and protected keywords to explicitly state the access-controls of class members. I would im.. 2020. 8. 7.
How to uninstall an npm Node package, locally or globally Ref. https://flaviocopes.com/npm-uninstall-packages/ Published Aug 16, 2018 To uninstall a package you have previously installed locally (using npm install in the node_modules folder, run npm uninstall from the project root folder (the folder that contains the node_modules folder). Using the -S flag, or --save, this operation will also remove the reference in the package.json file. If the packag.. 2020. 8. 6.
Object.keys, values, entries Ref. https://javascript.info/keys-values-entries Let’s step away from the individual data structures and talk about the iterations over them. In the previous chapter we saw methods map.keys(), map.values(), map.entries(). These methods are generic, there is a common agreement to use them for data structures. If we ever create a data structure of our own, we should implement them too. They are su.. 2020. 8. 5.
org.apache.log4j Class Level org.apache.log4j.Level All Implemented Interfaces:SerializableDirect Known Subclasses:UtilLoggingLevel public class Levelextends Priorityimplements Serializable Defines the minimum set of levels recognized by the system, that is OFF, FATAL, ERROR, WARN, INFODEBUG and ALL. The Level class may be subclassed to define a larger level set. Author:Ceki GülcüSee Also:Serialized Form Field S.. 2019. 12. 18.
javascript fetch 를 이용한 ajax 통신 및 주의점 팁/자료HTTP자바스크립트 fetch 란? fetch가 나오기전까진 자바스크립트에서 ajax을 쓰기란 매우 까다롭고 익스플로러랑 기타브라우저가 맞춰저 있지 않다보니 커먼라이브러로 만들어쓰거나 손쉽게 만들어져 있는 제이쿼리를 이용하였습니다. ajax이 처음 나오던 시절엔 사이트 전체에 극히 일부에서 사용하던 기술이었지만, 현재는 극단적으로 말해 SPA 처럼 ajax의 구성이 대부분인 사이트까지 있습니다. 그러다보니 새로운 표준이 필요했고 ES2015 쯤에 아래와 같이 공식 스펙으로 구현되었습니다. 참고: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch 형태 fetch(주소:string, 옵션); 옵션 상세 속성이름테스트3 met.. 2019. 10. 18.
Express API with autogenerated OpenAPI doc through Swagger In past years OpenAPI has arise as the preferred way to document APIs. In this article we will see how easy is document an API created with NodeJS and Express through the Swagger tools. If you are working in an REST API you more probably will desire to have some API doc where your users could find what are the endpoints of your API, what they do, which parameters they accept and which output the.. 2019. 8. 12.
5-2 nodemon 와 supervisor 모듈 node.js에서 콘솔작업을 한다면 js 파일 수정할때마다 ctrl+c -> node 파일명.js 노가다를 해야 합니다. 글자 하나만 고쳐도 말이죠. 하지만 nodemon 과 supervisor 모듈은 해당 js 파일을 수정만 하면 자동으로 재실행해주는 너무나 고마운 모듈들입니다. 글보단 실습이죠! 1. 먼저 설치를 합니다. $ sudo npm install -g nodemon sudo npm install -g nodemon 2. 설치된 nodemon 최신 버전은 1.0.15 입니다. 3. 실행 방법은 간단합니다. js 파일 시작시 node 파일명.js 대신 nodemon 파일명.js 를 해주면 됩니다. nodemon 파일명.js 4. 만일 해당 js파일의 파일 변경이 감지되면 자동으로 리스타트 됩니다.. 2019. 8. 9.
How to Update Node.js to Latest Version (Linux, Ubuntu, OSX, Others) As with so many open-source technologies, Node.js is a fast-moving project. Minor updates come out every few weeks to boost stability and security among all version branches. Methods abound for updating Node on any operating system, so you don’t have an excuse to fall behind. We’ve compiled some of the simplest and most effective ways to install the newest version of Node on Linux-based, Windows.. 2019. 8. 9.
Node.js Express FrameWork Tutorial - Learn in 10 Minutes In this tutorial, we will also have a look at the express framework. This framework is built in such a way that it acts as a minimal and flexible Node.js web application framework, providing a robust set of features for building single and multipage, and hybrid web application. In this tutorial, you will learn- What is Express.js? Installing and using Express What are Routes? Sample Web server u.. 2019. 8. 9.
Node.js: 비동기 프로그래밍 이해 대부분의 기업형 애플리케이션은 중앙의 서버에서 동작합니다. 이러한 서버는 Web을 위한 HTTP 서버 또는 소켓 통신을 위한 네트워크 서버 등이 있습니다. 서버는 중앙집중형태로 클라이언트의 요청을 받으므로 병목현상이 발생하기 쉬우며 처리 성능에 항상 주목해야 합니다.클라이언트의 요청이 많은 경우 서버는 병목 구간이 발생합니다. 이러한 병목구간을 분석해 보면 대부분 프로그램 로직보다는 입출력(IO)에서 발생합니다. IO에서 소요되는 비용은 생각보다 많이 나옵니다. 아래의 통계자료를 보면 주로 Disk 나 Network Access 시 비용이 가장 많이 나오는 것을 확인할 수 있습니다.IO의 비용이와같이 서버에서 IO를 처리하다가 지연이 발생하면 다른 요청들은 처리되지 못하고 계속 대기하는 현상이 발생합니다.. 2018. 8. 2.
React.js in patterns React.js in patterns/ blog / JavaScriptLong time I was searching for a good front-end framework. Framework that will help me write scalable and easy to maintain UI. Even though React is just a library for rendering it comes with so many benefits that I can easily say “I found it”. And like every thing that I use a lot I started seeing some patterns. Techniques that are applied over and over agai.. 2018. 7. 26.
[Node.js] javascript var, let, const 차이점 var, let, const 차이점은?var는 function-scoped이고, let, const는 block-scoped입니다.function-scoped와 block-scoped가 무슨말이냐?var(function-scoped)jsfiddle 참고주소// var는 function-scope이기 때문에 for문이 끝난다음에 i를 호출하면 값이 출력이 잘 된다. // 이건 var가 hoisting이 되었기 때문이다. for(var j=0; j 2018. 5. 10.
[HTML] iframe, meta, stylesheet iframe (아이프레임) floating frame 라고도 불리는 iframe 는 (internet frame) 의 약자로 그림이나 테이블과 같은 객체 처럼 프레임셋을 정의 하지 않고도 문서의 어느곳이나 원하는 위치에 프레임을 넣을 수 있습니다. iframe 이 지원되지 않는 웹 브라우저에 나타날 내용 iframe (아이프레임) 속성 src 프레임에 나타날 문서의 주소를 지정 합니다. name 의 이름을 지정 합니다. 하이퍼 링크의 target="" 지정에 사용 합니다. width 프레임의 가로 넓이를 지정 합니다. height 프레임의 세로 높이를 지정 합니다. marginwidth 프레임의 좌, 우 여백을 지정 합니다. marginheight 프레임의 상, 하 여백을 지정 합니다. framebord.. 2014. 11. 13.
jQuery의 JSONP 를 사용한 크로스 도메인 통신 AJAX를 이용하여 페이지간 비동기 통신을 하는데 서로 주고받는 데이터는 text, XML, JSON type으로 많이 쓰인다. 하지만 AJAX 호출을 필요로 하는 기능에서 보안상 이유로 동일 서버 이외에는 접근할수가 없다. ( not allow access.. 어쩌고 저쩌고 에러 메세지가 나온다.) 자바스크립트(Javascript) 보안 정책 중에 하나인 동일근원정책(Same-Origin Policy) 정책에 걸리는 부분이 바로 크로스 도메인을 할때 일어난다. 서로 다른 도메인에서 자바스크립트로 접근하려 했을 때 혹은 다른 서버에 Ajax통신의 결과를 받을 때 보안상 접근을 거부한다는 뜻이다. * 동일 근원 정책 참조 >> 동일출처정책(Cross domain 이슈) http://enterkey88.ti.. 2014. 10. 22.
XHR(Ajax) > Comet > HTML5 WebSockets 1. WebSodkets 란? }하나의 TCP소켓 연결로 쌍방향 통신을 지원하는 기술. 웹서버와 브라우저에서 구현되기 위해 고안되었지만 모든 클라이언트와 서버 프로그램간에서 사용 가능. WebSocket API는 W3C(http://www.w3.org/TR/websockets/#network-intro)에서 정의하고 있고, WebSocket 프로토콜은 IETF(Internet Engineering Task Force) 에 의해 정의 됨. }HTTP, FTP, TELNET 등과 같은 Application layer의 프로토콜 사용. }80번 이외의 포트로 시도되는 일반적인 TCP 연결은 관리자의 보안 정책에 따라 막히는 경우가 많기 때문에 이런 제약을 극복할 수 있는 방법이 될 수 있음. 2. 배경 }19.. 2014. 10. 22.
[JavaScript] Ajax - XMLHttpRequest(XHR) Same-Origin 정책(동일근원정책) 브라우저에는 동일 근원 정책이 있음. 같은 도메인 안에서만 XHR 호출이 가능 - SOP XMLHttpRequest(XHR) Ajax 는 Asynchronous JavaScript and XML의 약자 비동기 통신 페이지 전체를 로드하지 않고 일부분만 로드하여 DOM을 사용하여 내용을 추가하거나 바꿀 수 있다. XHR의 순서 1. XHR선언 2. 옵션 ( 콜백함수 설정) 3. 서버에 HTTP요청 4. 콜백함수에서 서버의 응답 받아와서 처리 1. XHR 선언 var XHR = new XHLHttpRequest(); 익스플로러 경우에 따라 var XHR = new ActiveXObject("Msxml2.XMLHTTP"); var XHR = new ActiveXObje.. 2014. 10. 22.
Ajax를 이용한 json 송 수신 1. javascript에서 json객체 만드는 방법 - 객체에 property추가 var obj = new Object(); obj.id = 'id'; obj.password = '#pw'; obj.idStore = 'on'; - 객체를 json으로 만듬 var jsonData = JSON.stringify(obj); 2. 자바단에서 Json, JsonArray객체 만드는 방법(Simple JSON api사용) 2.1 Json객체 새로 만들기 JSONObject obj = new JSONObject(); obj.put("name","PC"); 참고로 JSONObject는 map처럼 key와 value값으로 넣을 수 있다. 2.2 Json형태의 string으로 부터 json객체 만들기 JSONObject.. 2014. 2. 26.