Giter Site home page Giter Site logo

basic-node's Introduction

Basic-Node

Single thread can manage multiple connections

Because, non-blocking I/O model

What is non-blocking I/O model

When we run nodejs in sarver it's perticuler one thread can handel many connections.    
Let suppose, I run a process which is I/O bound mean's wait for database excutor fatch so it's doesn't block thread and wait for a callback. When that particular I/O bound resolved a event fired.    

What is nmp?

nmp stands for node package manager.

why use [npm init] command

This utility will walk us through creating a package.json file.

What is Expressjs?

Express is a flexible Node.js web application framework that provides a strong set of features for web and mobile applications.

How to install Express in myapp directory and save it in the dependencies list?

$ npm install express

To install Express temporarily and not add it to the dependencies list:

$ npm install express --no-save

How to uninstall express

$ npm uninstall express

What is nodemon?

nodemon is a tool that helps develop Node.js based applications by automatically restarting the node application   when file changes in the directory are detected

Install nodemon in our system path globally:

$ npm install -g nodemon

Install nodemon as a development dependency:

$ npm install --save-dev nodemon

How to uninstsll?

$ npm uninstall nodemon

After download nodemon in your system if you get error like [nodemon : File C:\Users\user\AppData\Roaming\npm\nodemon.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.]

1. Open PowerShell (Run As Administrator)  
2. Check the current execution policy using this command  
    Get-ExecutionPolicy
    # You should get 'Restricted'
3. Run this command to make it 'Unrestricted'  
    Set-ExecutionPolicy Unrestricted  
4. Check again whether execution policy changed by running this command  
    Get-ExecutionPolicy
    # You should get 'Unrestricted'
5. Now try to run nodemon on your project  
    nodemon 'filename.js'  

How to import-export in CommonJS module?

From second.js to first.js  

(second.js)---
function Simple(){
console.log("Hello World");
}
module.exports = Simple;

(first.js)---
const Simple = require("./second.js");
Simple();  

How to use ES6 module?

STEP-1: go to package.json file and add   "type":"module", after "author":"Teuton",  

STEP-2: add file name with mjs (first.mjs).  

basic-node's People

Contributors

teuton-roy avatar

Stargazers

Praveen Nanda 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.