기본 콘텐츠로 건너뛰기

NodeJS: In Three(ish) Minutes.

NodeJS: In Three(ish) Minutes.

NodeJS: In Three(ish) Minutes.

3분 만에 NodeJS 파해치기 :)

This is a new format I'm considering trying, so let me know if you like it.

내가 이제 새로운 방식으로 글을 써보려고해. 맘에 들면 말 해줘.

I'm going to take a topic, probably always a technology, and explain it as concisely and clearly as possible in 3 minutes.

앞으로 간결, 깔끔하게 3분 내로 읽을 수 있도록 한 주제에 대해 얘기해볼꺼야. (아마도 항상 기술분야가 되겠지만..)

To begin I'll choose the focal technology of my recent article, NodeJS. So let's begin!

첫 시작은 나의 최근 글들의 중심 기술인 NodeJS다. 시작할겡 :)

NodeJS was created in 2009 by Ryan Dahl.

Ryan Dahl이 NodeJS를 2009년에 만들었어.

Prior to NodeJS, Dahl had been working as a developer using Ruby on Rails.

NodeJS 나오기 전에, Ryan은 Ruby on Rails를 사용하는 개발자였지.

He got the base concept for NodeJS while using Flickr (an image uploading and sharing website), and he noticed that there was a progress bar, that told him the status of his image uploading.

Ryan은 Flickr(이미지를 업로드하고 공유하는 웹사이트[https://www.flickr.com/])를 사용하면서 NodeJS에 대한 기본 개념을 생각해냈고, 이미지가 업로드 되는 상태를 나타내는 progress bar가 있다는걸 알았지.

It seems almost a fickle feature now, but back in the late 00s, that kind of server-always-talking behaviour was new and rare.

지금은 그게 아주 변덕스러워 보이지만, 2000년 후반 server-always-talking 종류의 방식은 새로운 것이었고 귀했지.

This was the case because back then, servers didn't really have the ability necessary to process multiple things at once, such as uploading a file and also handling other requests from the same user, an idea known as concurrency.

그 당시에, 서버는 한 번에 여러 항목을 process할 수 있는 능력이 없었어. 예를 들어, 한 사용자 보낸 요청을 처리하면서 파일을 업로드할 경우 말야. concurrency에 대한 개념이지.

Seeing this interaction between browser and server sparked something in Dahl.

Ryan은 browser하고 server가 상호작용 하는걸 보면서 영감을 받았어.

He realised that a web server needs to be able to process multiple things at the same time.

Ryan은 web server는 여러 항목을 동시에 처리 할 수 있어야 한다는 걸 깨달은거지.

The old method of get a request/send a response was outdated and ill fitting.

get a request(요청을 받는 것)과 send a response(응답을 전송하는 것) 은 오래된 방법은 시대에 뒤쳐지고 부적절했지.

I don't know about you but that doesn't make a tremendous amount of sense to me, so let me explain it further with a diagram

너도 그런지는 모르겠지만 나는 이게 이해가 잘 안돼. 그래서 그림을 통해 한번 봐보자 :)

A request comes in, in this case it's a request to upload a file.

파일을 업로드하는 요청이 들어왔다 생각해보자.

The server accepts that request, and while it is processing that request (the thick dark line to the right) it handles other requests, before finally returning a response to the main request.

server가 요청을 수락하고 처리하는 동안(맨 오른쪽에 두꺼운 까만줄), 가장 중심적인 request를 응답하기 전에 다른 요청들을 처리 하는거지.

This is the concept of concurrency at the root of NodeJS.

이게 바로 NodeJS에서 근간이 되는 concurrency에 대한 개념이야.

It was built by Dahl and co in Javascript using a wonderful implementation of technology, in the form of Google's V8 engine.

이 concurrency에 대한 개념은 Ryan과 공동으로 Google의 V8엔진 형태의 멋진 Javascript기술로 만들어졌어.

This engine takes Javascript code, and compiles it into C++, which executes at lightning speeds.

Google's V8 엔진은 Javascript code를 받아서, 겁나 빠르게 실행 할 수 있는 C++로 compile 하지.

V8 does this on the fly, and compiles quickly upon execution.

V8 엔진은 이를 즉시 수행하며, 실행 시 컴파일 되지.

This is partly what gives NodeJS it's edge when it comes to speed compared to other programming languages and frameworks.

이게 바로 NodeJS가 부분적으로 다른 프로그래밍 언어나 프레임워크랑 속도 면에서 비교 했을때 장점이 있는 이유야.

NodeJS wasn't back then, and still isn't, a web server by default.

NodeJS는 기본적으로 웹서버가 아니였고 지금도 아니야.

When you get NodeJS out of the box, it doesn't just start a web server.

너가 NodeJS를 딱 시작하면, 이건 뭐 웹서버를 시작하지도 않지.

Developers have to utilise either frameworks, or write the logic directly on top of NodeJS, to make it into a web server.

개발자들이 NodeJS에서 프레임워크를 활용하거나 코드를 작성해야만 web server를 만들 수 있어.

So why isn't NodeJS just a web server by default, if that's why it was invented?

그렇다면 왜 NodeJS는 기본적으로 웹서버가 아닐까? 왜 NodeJS는 만들어 졌을까?

It's because NodeJS was built to address an issue greater than just the problem of multiple requests to a website, it was built to address the idea of multiple requests and of processing multiple things at once.

NodeJS는 웹사이트의 여러개의 requests를 처리하는 문제보다 더 큰 문제를 해결하기 위해 만들어졌기 때문이야.

여러 request를 처리하고 동시에 여러 항목을 process하기 위해 개발 된거지.

That's part of the reason for the popularity of NodeJS, because it can do a lot more than just web servers.

그게 바로 NodeJS가 인기를 얻은 이유중 하나지. NodeJS는 web server보다도 더 다양한 것들을 할 수 있거든.

NodeJS is used for the aforementioned web servers, but also as an operating system, a logging tool (to record say, http requests, or user generated behaviour in a desktop application), a general scripting language, and I have personally used it for developing neural networks and machine learning.

NodeJS는 앞서 말한 web servers로도 사용되지만 또한, 운영체제, logging tool(녹음, http requests, 데스크탑 프로그램의 유저행동 기록), general scripting(자동 작업)으로도 사용이 돼.

그리고 나는 개인적으로 NodeJS를 신경망 네트워크나 machine learning(기계 학습)에 사용 해오고 있지.

But because it is by far most commonly used for web servers, I'm focusing on that aspect the most.

그러나 지금까지 NodeJS가 대부분 웹서버로 사용되고 있어서, 나도 웹서버 쪽에 집중하고 있어.

Anyway let's jump ahead to NodeJS in 2018.

어쨌든 2018년 NodeJS로 넘어가자.

It is now most commonly used for developing Backends.

이제 NodeJS는 Backends를 개발 할 때, 완전 핫하지.

Backend meaning the part of the website you don't see; all the logic that makes a website work.

Backend란 website내에서 너가 보지 못하는 부분을 의미해; website가 작동하도록 하는 모든 logic들 말야.

It is however also commonly coupled with the major Frontend frameworks, the part that you do see and interact with, to make what's called a Full-Stack environment.

또한, 주요한 frontend(유저가 website내에서 볼 수 있는 부분) 프레임워크들과 결합되어서 Full-Stack 환경을 만들지.

These include Angular, Vue, and React, to name the most popular frameworks.

Frontend 프레임워크들 중 요즘 가장 핫한 건 Angular, Vue 그리고 React야.

I can go more into this full-stack development topic in another article.

내가 나중에 full-stack development에 대해선 다른 글로 좀더 자세히 설명해 줄게.

NodeJS comes with a resource called NPM bundled into it.

NodeJS는 NPM이라고 불리는 resource가 번들로 제공이 돼.

NPM allows the developer to manage packages, which are useful Javascript functions, and to add them to any NodeJS project.

NPM은 개발자가 packages(유용한 Javascript 함수)를 관리하고, 어느 NodeJS 프로젝트에도 넣어 사용할 수 있게 해주지.

Using packages speeds up development and allows the developer to abstract away a lot of the nitty gritty development, allowing for faster code iterations.

packages를 사용해서 개발 속도를 빠르게 하고 껄끄러운 개발사항이나 코드반복을 처리 할수 있게 해줘

So let's summarize.

자, 요약해보자 :)

NodeJS is a Javascript framework, built in Google's V8 engine, and it was built to serve the need of processing multiple requests at once.

NodeJS는 Google의 V8 engine안에서 만들어진 Javascript 프레임워크야. 그리고, 여러개의 requests를 한번에 처리하기 위해 만들어졌지.

It does this very well, and has become one of the most popular frameworks for developing websites because of it.

그걸 아주 잘하기에 웹사이트 개발에 가장 인기있는 프레임워크가 됐지.

And finally, developers can use the built-in NPM to add other Javascript frameworks and libraries, to speed up their own development.

마지막으로, 개발자들은 NodeJS에 장착된 NPM(필요한 프레임워크나 라이브러리를 추가 할 수 있는 패키지 관리 툴)을 사용해 개발을 겁나 빨리 할 수 있어.

So that's NodeJS very quickly! I hope you enjoyed.

NodeJS를 빠르게 설명해봤어. 너가 즐거웠기를 바래.

출처: https://medium.com/@kieranmaher13/nodejs-in-three-ish-minutes-4c4401b43b2c

Ps. 첫 번역이라 틀린게 있어도 양해부탁드려요 :)

from http://menuand.tistory.com/3 by ccl(A)

댓글

이 블로그의 인기 게시물

[Mac OS X] 데스크탑 응용프로그램 개발시작

[Mac OS X] 데스크탑 응용프로그램 개발시작 현재 회사에서 다음 프로젝트로 Mac OS X를 개발해야 하는 일정이 생겨 난생 처음 데스크탑 응용프로그램을 개발하기 공부를 시작했고 여러가지 플랫폼이 있다는것을 발견했다. 어떤 플랫폼을 사용해야할 지 먼저 고민해보자. 무엇으로 개발할것인가? Xcode & Swfit or Objective-C Mac OS X 는 objective-c를 기반으로 만들어졌다. apple에서 제공하는 Xcode와 objective-c 혹은 Swift로 응용 프로그램을 만들 수 있다. Electron Electron 프레임워크를 사용하면 javascript, HTML, CSS를 사용하여 크로스 플랫폼 데스크탑 응용 프로그램을 만들 수 있다. react-native-desktop Qt 프레임 워크를 기반으로하는 크로스 플랫폼이다. react-native 와 javascript로 응용 프로그램을 만들 수 있다. Qt는 컴퓨터 프로그래밍에서 GUI 프로그램 개발에 널리 쓰이는 크로스 플랫폼 프레임워크. 각 플랫폼의 장단점은 무엇인가? Xcode & Swfit or Objective-C - 장점 모든 OSX API에 직접 접근할 수 있다. Xcode를 통해 App Store에 쉽게 배포할 수 있다. - 단점 Windows 전용 응용 프로그램을 다시 개발해야한다. Swift언어를 모른다면 새로 공부해야 한다. Electron - 장점 웹스택을 가지고 빠르게 만들 수 있다. 다양한 플랫폼을 지원한다. - 단점 Native언어로 개발할때 보다 성능이 떨어질 이슈가있다. OS X API를 사용하는데 복잡하다. *API에 대한 JavaScript 래퍼가 없으면 자체 래퍼를 작성하지 않는 한 프로젝트에서 사용할 수 없습니다. React-native-desktop - 장점 현재 개발스택과 완전히 동일하므로 더 빠르게 개발 할 수 있다. 다양한 플랫폼을 지원한다. - 단점 N...

AWS CI/CD 파이프라인에 Slack 알람 적용(Lambda, CloudWatch Events 연동)

AWS CI/CD 파이프라인에 Slack 알람 적용(Lambda, CloudWatch Events 연동) 이번 글에서는 구축된 CI/CD 파이프라인과 Slack 알람을 연동하는 방법에 대해서 알아볼 것이다. CI/CD 파이프라인 시작/종료(성공/실패) 시 Amazon CloudWatch Events에서 해당 이벤트를 감지한 후 AWS Lambda로 트리거 신호를 보내면 AWS Lambda에서 Slack채널로 알람을 보내는 프로세스다. 글의 순서는 다음과 같다. Amazon CloudWatch Events, AWS Lambda란? 실습 전 준비사항 Slack Webhook 생성 AWS Lambda 함수 생성 AWS CloudWatch Events 생성 테스트 위와 같은 방식으로 구축을 하면 최종 프로세스는 다음 그림과 같다 (우리가 이 글에서 진행하는 내용은 빨간색으로 표시된 부분) 1. Amazon CloudWatch Events, AWS Lambda란? 1-1. Amazon CloudWatch Events란? Amazon CloudWatch Event(혹은 AWS CloudWatch Events)는 AWS 상태 변경 등을 감시할 수 있는 기능이다. 만약 사용자가 만든 규칙에 맞는 이벤트가 발생하게 되면 해당 이벤트가 사정에 정의된 규칙과 일치할 경우 하나 이상의 대상 작업을 호출한다. 이벤트 유형에 따라 알람을 보내거나, 이벤트 정보를 캡쳐하거나, 교정작업을 수행하거나, 이벤트를 시작하거나, 기타 작업을 수행할 수 있다. 이벤트가 발생할 경우 대상 작업은 AWS Lambda함수, AWS Kinesis 스트림, AWS SQS, Amazon SNS 등이 있다. 사용되는 사례로는 1) 이벤트가 발생하면 Lambda함수를 사용하여 Slack채널로 알림을 전달하거나, 2) AWS 상태 이벤트가 발생하면 Lambda 및 CloudWatch Events를 사용하여 Amazon SNS로 사용자 지정 텍스트 또는 SMS 알림을 보내는 등...

[2020-angstromCTF] web - A peculiar query write-up

[2020-angstromCTF] web - A peculiar query write-up English write-up UI seems like below. If you click the 'the source' link, you can get back-end source code. const express = require("express"); const rateLimit = require("express-rate-limit"); const app = express(); const { Pool, Client } = require("pg"); const port = process.env.PORT || 9090; const path = require("path"); const client = new Client({ user: process.env.DBUSER, host: process.env.DBHOST, database: process.env.DBNAME, password: process.env.DBPASS, port: process.env.DBPORT }); async function query(q) { const ret = await client.query(`SELECT name FROM Criminals WHERE name ILIKE '${q}%';`); return ret; } app.set("view engine", "ejs"); app.use(express.static("public")); app.get("/src", (req, res) => { res.sendFile(path.join(__dirname, "index.js")); }); app.get("/", async (req, res) => { if (req.query...