Code Monkey home page Code Monkey logo

node-practice's Introduction

NODE

https://nodejs.org/en/docs/

  • GLOBALS - NO window

  • __dirname - path to current directory

  • __filename - file name

  • require - function to use modules (Common JS)

  • module - info about current module (file)

  • process - info about env where the program is being executed.


NPM

https://www.npmjs.com/

  • npm - global command, comes with node

  • Run npm --version .

  • Local dependency - use it in any object

  • Run npm i 'packageName' to install any package.

  • Run npm i 'packagename' -D OR --save-d to install as dev dependencies.

  • Global dependency - use it in any project

  • RUn npm install -g 'packageName'.


package.json

  • package.json - manifest files(stores imp info about project).

  • Manual approach ( create package.json in the root, create properties)

    • npm init (step-by-step)
    • npm init -y (everything default)
      • e.g. package lodash npm i lodash in terminal.
      • Run npm install after cloning the projects and it will install all dependencies.
  • To uninstall run npm uninstall 'packagename'.


Events

  • Event-driven programming
  • Used heavily in Node.js
  • on - listen for an event
  • emit - emit an event
  • possible in server side
  • listen for specific events and register functions that will execute in response for those events.
  • Once events takes place callback func fires.

Streams

  • Used to read or write sequentially.
  • writable, Readable, Duplex, Transform.
  • Extend events emitter class.
  • data is read in chunks each for 64KB.

node-practice's People

Contributors

nit-isha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.