← Back to Node.js Course | Chapter 7: Express.js Basics | Lesson 2 of 7

Express Install करना

npm से अपने project में Express install करें और फिर अपने code में इसे require करें।
Syntax
javascript
npm init -y
npm install express

const express = require('express');
const app = express();

Express Install करना

npm init -y फिर npm install express चलाएँ। फिर Express node_modules में है और dependencies के अंतर्गत listed है। इसे load करने के लिए require या import इस्तेमाल करें और app बनाने के लिए express() call करें।

Note: surprise changes से बचने के लिए एक major version pin करें, उदाहरण के लिए express@4।

उदाहरण: Installing Express

bash
$ mkdir api && cd api
$ npm init -y
$ npm install express
added 64 packages in 3s
$ node -e "console.log(require('express/package.json').version)"
4.19.2

⚠️ Run this in your own terminal or Node.js environment.

Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. पहले npm init भूल जाना
  2. globally install करना
  3. dependency save न करना
चैप्टर सारांश
  • npm install express से install करें
  • यह dependencies में appear होता है
  • इसे require करें और express() call करें
  • major version pin करें
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.