'Application, App/Node.js'에 해당되는 글 3건

노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


How To Install Node.js on a CentOS 7 server


-node.js를 centos 7에 설치하는 방법


Introduction/소개

Node.js is a Javascript platform for server-side programming. It allows users to easily create networked applications that
require backend functionality. 
By using Javascript as both the client and server language, development can be fast and consistent.

Node.js는 서버쪽 프로그래밍을 위한 자바스크립트 플랫폼이다. 이것을 개발자에게 백엔드
기능을 갖춘 네트웍 처리를 하는 어플리케이션을 만들기 쉽게 해준다.
클라이언트와 서버 언어 양쪽을 자바스크립트를 사용하는 것은 개발은 빠르고 일관성있게 해 준다.

In this guide, we will show you a few different ways of getting Node.js installed on a CentOS 7 server so that you can get started.
Most users will want to use the EPEL installation instructions or the NVM installation steps.

이 가이드에서는, CentOS 7 서버에  Node.js를 얻는 몇가지 방안을 보여주고 시작할 수 있게 해 줄 것이다.
대부분의 사용자는 EPEL 설치 방식과 NVM 설치 절차를 사용하는 것을 원할 것 같다.

1. Install Node from Source / 소스를 통한 설치

 One way of acquiring Node.js is to obtain the source code and compile it yourself.
 To do so, you should grab the source code from the project's website. On the downloads page,
 right click on the "Source Code" link and click "Copy link address" or whatever similar option your browser gives you.


 >wget http://nodejs.org/dist/v0.10.30/node-v0.10.30.tar.gz
 >tar xzvf node-v* && cd node-v*
 >sudo yum install gcc gcc-c++
 >./configure
 >make
 >sudo make install
 >node --version

2. Install a Package from the Node Site / 패키지를 통한 설치
 Another option for installing Node.js on your server is to simply get the pre-built packages
 from the Node.js website and install them.

 cd ~  wget http://nodejs.org/dist/v0.10.30/node-v0.10.30-linux-x64.tar.gz

3. Install Node from the EPEL Repository/ EPEL저장소를 통한 설치
 

An alternative installation method uses the EPEL (Extra Packages for Enterprise Linux) repository
 that is available for CentOS and related distributions.

 >sudo yum install epel-release
 >sudo yum install nodejs
 >node --version
 v0.10.30

4. Install Node Using the Node Version Manager / NVM을 통한 설치
 

Another way of installing Node.js that is particularly flexible is through NVM, the Node version manager.
 This piece of software allows you to install and maintain many different independent versions of Node.js,
 and their associated Node packages, at the same time.

 >curl https://raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh
 >curl https://raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh | bash
 >nvm list-remote


Conclusion / 결론


 As you can see, there are quite a few different ways of getting Node.js up and running on your CentOS 7 server.
 ~

원문 : https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-a-centos-7-server

'Application, App > Node.js' 카테고리의 다른 글

Node.JS 웹 채팅 (간단한 예제)  (0) 2017.02.07
(1) 소개 - Node.js  (0) 2016.05.20
블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


Node.JS 웹 채팅 (간단한 예제)


소스 구성 : app.js ( package.json) , index.html ( java script )



1. package.json

{
  "_comment" : "0. setup package",
  "name":"chat",
  "version" : "0.0.1",
  "private": "true",
  "dependencies" : {
    "socket.io" : "1.4.2",
    "express" : "4.13.4"
  }
}


2.app.js

- require

// SOCKET.IO Setup
var app = require('express')();
var http = require('http').createServer(app);
var io = require('socket.io')(http); //initialise after http server

- listen

// http.listen
http.listen(3000, function(err) {
    if ( err ) {
        console.log(err);
    } else {
        console.log('listening on *: 3000')
    }
} );

- get / send index.html

// app.get
app.get('/', function(req, res) {
    // index.html
    res.sendFile(__dirname + '/index.html');

});

3. edit index.html

<head>
    <!-- 4. definition form -->
    <style>
        #div-chat-display {
            height:350px;
            width:500px;
            overflow-x: hidden;
            overflow-y: auto;
        }
    </style>
</head> 
<body> 
    <!-- 4. definition form -->
    <h3>Just simple your webChat ( v 0.0.1,  @stanwix , 21-Apr-2016 ) </h3>
    <div id="container-id">
        <form id="form-input-userid">
            your ID :  <input size="15" id="input-userid"/>
            <input type="submit" value="Join"/>
        </form>
    </div>
    <div id="container-message" style="display: none;">
        <div id="div-chat-display"></div>
        <form id="form-send-message">
            <input size="35" id="input-message"/>
            <input type="submit" value="Send"/>
        </form>
    </div>
</body> 

4. include javascript

   <!-- 5. setup js script -->
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>

5. javascript for message handle

아래 소스를 참조


소스

https://github.com/sketchout/NodeJs_SocketIO_PartOne


'Application, App > Node.js' 카테고리의 다른 글

Node.js를 CentOS에 설치하는 방법들  (0) 2017.02.07
(1) 소개 - Node.js  (0) 2016.05.20
블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.



Node.js



Node.js는 확장성 있는 네트워크 애플리케이션(특히 서버 사이드) 개발에 사용되는 소프트웨어 플랫폼이다. 작성 언어로 자바스크립트를 활용하며 Non-blocking I/O와 단일 스레드 이벤트 루프를 통한 높은 처리 성능을 가지고 있다.


내장 HTTP 서버 라이브러리를 포함하고 있어 웹 서버에서 아파치 등의 별도의 소프트웨어 없이 동작하는 것이 가능하며 이를 통해 웹 서버의 동작에 있어 더 많은 통제를 가능케 한다.



개요


V8 (자바스크립트 엔진) 위에서 동작하는 이벤트 처리 I/O 프레임워크이다. 웹 서버와 같이 확장성 있는 네트워크 프로그램 제작을 위해 고안되었다.


파이썬으로 만든 트위스티드, 펄로 만든 펄 객체 환경, 루비로 만든 이벤트머신과 그 용도가 비슷하다. 대부분의 자바스크립트가 웹 브라우저에서 실행되는 것과는 달리, 서버 측에서 실행된다. 일부 CommonJS 명세[2]를 구현하고 있으며, 쌍방향 테스트를 위해 REPL 환경을 포함하고 있다.




원문 : https://ko.wikipedia.org/wiki/Node.js


'Application, App > Node.js' 카테고리의 다른 글

Node.js를 CentOS에 설치하는 방법들  (0) 2017.02.07
Node.JS 웹 채팅 (간단한 예제)  (0) 2017.02.07
블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,