Node.js in Flitto

  • View
    11.688

  • Download
    4

Embed Size (px)

Text of Node.js in Flitto

  • p l a y . n o d e ( ) ;

    asbubam @ Flitto ?

    photo by

    Jongho Jang

  • C,Javain

    RubyonRails,Node.jsinNews1

    Node.jsinFlitto

    PunkBandbass

    FashionPhotographyinTokyo

    SeungwooLeeEngineerasbubam@Flitto.com

    dalsdoll

    mailto:asbubam@flitto.com?subject=

  • ::

    .

    photo by Jongho Jang

    www.flitto.com store

    http://www.flitto.com

  • Flitto

  • .-

    .

  • languagebarrier

    ??

  • minj9

    .:)

  • languagebarrier

    ,

    .

  • www.Flitto.com

    www.Flitto.com,!

    http://www.flitto.comhttp://www.flitto.com

  • 50Node.js(20)

    160endpoint*CRUDRESTAPI

    .

    Node.jsinFlitto

  • AWS.

  • backbone.js,angular.jsjquery.

    sequelize.

  • main server

    push

    admin

    crawler

    task

    api / front end

    ,,,,.

  • main server

    push

    admin

    crawler

    task

    api / front end

    PostgreSQL(RDS),mongoDB,

    Redis.

  • - app- models- services- routes- views- utils- test-

    -public

    express.

  • Node.js4.2.1production(2015/10/27)

    node_modules

    npmcachenode_gyp

    https://github.com/nodesource/distributions

    https://github.com/nodesource/distributions

  • v0.8.x=>2012/10/17AWSt1.micro

    v0.10.xv0.10.=>2013/05/20v0.12.x

    v4.2.1LTS=>2015/10/27

    Node.js

    v0.12.7:(57.3+60.8+61.5+66.4+69.3)/5=63.06/secv4.2.1:(57.1+73.9+74.8+75.4+78.4)/5=71.92/sec

    (71.92-63.06)/63.06*100=14.05%

    20005

    214.05%

    .

  • express4.x.x

    express4.8.x.

  • aws-sdkcrongeoipgmhirediskuemomentnodemailerqr-image

    cron:geoip:ipgeolocationgm:,hiredis:redisLRANGEkue:redis,moment:i18nnodemailer:,qr-image:qr

  • = +

    https://www.jetbrains.com/webstorm.:)

    https://www.jetbrains.com/webstorm

  • 3.

  • dbschemaflyway

    flywaydbschema.,dbschema.

  • step/async/promise

    CallbackWhat?

    Callbackstepasync

    promise.

    Node.jsCallback.

    .

  • tpl()/

    tpl(),

    ,.

  • pg_node

    pg

    querystringlog()

    postgresqlpg

    queryparameterloglog.

  • ,.

  • :grunt+python:grunt+gulp

    JS,cssgrunt+gulp.

  • 18->error18

    ,,apii18nredispub/sub

  • getError(errCode,language);

    {statusCode:404,body:{code:404,desc:NotFound,message:.resource:url}} errCodelanguage

    .statusCodehttpbody.code.

    ()().

  • testmocha,should

    testmochashould.

  • forever->pm2

    foreverpm2pm2.pm2,.

  • !

    !=

    170,.

  • dev/staging/real

    dev/staging/real.

  • Fabric

    +

    Fabric.,

    Jenkins.

  • AWSELB

    AWSELB,aws-sdk

    ELB.

  • loggingwinston/morgan

    winstonmorgan.

  • socket.io

    +redispub/sub

    socket.io+redispub/sub.

    http://socket.io

  • admin

    :backbone.js:angular.js,sequelize

    ,.backbone.js

    angular.jssequelize.

  • ,

    ,Node.js.Node.js.:)

  • u+xpay,alipay,paypalgiftishow,happymoney

    Node.js

    php,javaapiNode.js.

  • s350

    aws-sdk,async(queue)

    varAWS=require(aws-sdk'),s3=newAWS.S3(),fs=require(fs),targetFile=fs.createWriteStream(targetFilePath);

    varread=s3.getObject({Bucket:bucket,Key:filePath}).createReadStream();read.pipe(targetFile);

    AWSS3aws-sdk+stream.

  • 32,.~.

    mecab-ffi()mecab-ko(MeCab)@xissyNode.js

  • 200ml 13 0610/ 30/ 12/ . 1. 500 (2.5cm) . 2. > . 1. . 2. > . . 1) . . . 2) 3. 1) 2) 3) . 1.(>)-200ml, 2.()-200ml, 3.()-200ml / 1.(),2.(),3.()

    | 2 | 2 | 2 | 2 | 2 | 2 | 2

    | 2

    mecab-ffi.:)

  • surrogatepairUTF-16(16-bitUnicodeTransformationFormat).(BMP,Basicmultilingualplane)1632.

    ,16(Surrogate)16(32).

    https://ko.wikipedia.org/wiki/UTF-16

    surrogatepair

    https://ko.wikipedia.org/wiki/UTF-16

  • https://www.flitto.com/twitter/158

    emojisurrogatepair

    https://www.flitto.com/twitter/158

  • > var str = \ud83d\ude03';> str

    > str.length

    str.length?

  • > var str = \ud83d\ude03';> str

    > str.length13

    > encodeURI(str.slice(0,10))URIError: URI malformed at encodeURI (native)

    13.10emojislice.

  • > var str = \ud83d\ude03';> str

    > str.length13

    > encodeURI(str.slice(0,10))URIError: URI malformed at encodeURI (native)

    > var decodedArr = punycode.ucs2.decode(str);> var slicedStr = punycode.ucs2.encode(decodedArr.slice(0,10));> slicedStr

    > encodeURI(slicedStr);.

    https://goo.gl/uZIV7m

    node.jsv0.6punycodedecodingslice.

    ->https://t.co/fbehjnz8fQ

    https://goo.gl/uZIV7mhttps://t.co/fbehjnz8fQ

  • forEach~~..

    users.forEach(function(user){});

    async.queue

    !

  • npminstall.!

    ex)"sequelize":latestsequelizev2v3.

    !

  • 3

    aws1..

    ,.:)

  • es6

    es6.

  • es6

    11/10feature!!!

    11/10featureclass.:)

  • Node.jsproduction

    node.jsinproduction

    node.jsinproduction().

  • NPMpackage

    NPMpackage

    .

  • geoipPR

    ,PR.:)

  • Node.js4!!

    .!,

    Node.js!Node.js,Node.js.:)

  • 1

    2

    1

    2

    2.

    12.

    12

    .:)

  • asbubam

    asbubam@Flitto.com

    .:)

    ,.

    ,!:)

    ,,,,,

    ,!

    http://flitto.com