part1 - 課程教材教材名稱: node.js 模組機制

26
Part1 - 課程教材 教材名稱: Node.js 模組機制 國立高雄大學資訊工程學系 張保榮教授 計劃名稱: 104年度教育部資通訊軟體創新人才推升推廣計畫 跨校資源中心: 雲端運算(國立中山大學) 課程名稱: 網路及平台服務

Upload: hoanghanh

Post on 03-Feb-2017

276 views

Category:

Documents


7 download

TRANSCRIPT

  • Part1 -

    : Node.js

    : 104: ():

  • CommonJS

    NPM

  • CommonJS

    JavaScript

    CommonJS APIs

    I/O

    CommonJS

    Node.js CommonJS

    Modules/1.0

  • Node.js JavaScript

    C/C++

    require()

  • module.exports

    require()

    hello_module.js

    call_hello_module.js

  • require()

    ./

    require()

    index.js

  • ( Key/Value )

    object_module.js

    call_object_module.js

  • module.exports

    myobject.js

    call_myobject.js

  • Node.js

    Web

  • NPM

    Node.js NPM Node.js

    NPM

    NPM Node.js

    http://npmjs.org/

    cmd NPM

    npm [] []

  • NPM

    npm install NPM

    npm prefix

    npm init package.json

    npm adduser NPM

    npm publish NPM

    npm version

    npm author

    npm tag tag

    npm search NPM

    npm view package.json

  • NPM

    npm home homepage

    npm repo repository

    npm update

    npm list

    npm outdated

    npm prune

    npm deprecate deprecate

    npm unpublish NPM

    npm rebuild Native module

    npm run-script package.json

  • NPM

    npm [stat|stop|test|restart] package.json

    npm [star|unstar] star star

    npm help NPM help

    npm faq NPM faq

    npm whoami

    npm cache npm cache

  • cmd NPM

    npm install []

    NPM

    node_modules

  • Node.js

    cmd

    npm install -g []

  • NPM

    my_module/

    lib/my_module.js

    package.json

    README.md

  • lib/

    lib JavaScript

    package.json

    README.md

    node_modules

  • package.json

    package.json npm

    init

    package.json

  • name NPM

    npm info []

    version 0.0.1

    description

    mainNode.js

  • package.json

    Node.js package.json

    homepage

    homepage

    dependencies

    npm

    ( Key/Value )

  • package.json dependencies

    npm install

    engine Node.js API

    author

    contributors

  • license

    repository github

    http://npmjs.org/doc/json.html

  • https://www.npmjs.com/signup NPM

  • NPM npm

    NPM

    cmd npm adduser

    npm publish [ ]

    npm version []

    package.json

  • ( Native Module/Addon )

    C/C++ ( Native

    Module ) ( Addon ) C/C++

    Node.js

    Node.js

    Node.js

    http://nodejs.org/api/addons.html

  • END