Express Install करना
npm से अपने project में Express install करें और फिर अपने code में इसे require करें।
In this page:
Syntax
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
$ 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. #}
आम गलतियां
- पहले npm init भूल जाना
- globally install करना
- 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: