Loading

Quipoin Menu

Learn • Practice • Grow

express-js / express-js - interview
interview

Q1. What are the prerequisites for setting up Express.js?
The main prerequisite is Node.js installed on your system. Express.js runs on Node.js, so you need Node.js (which includes npm) to install and run Express applications. Basic knowledge of JavaScript and terminal/command line is also helpful.

Q2. How do you check if Node.js is installed?
Open your terminal or command prompt and run: node --version and npm --version. If installed, these commands will display the version numbers. If not, you'll get an error message, and you'll need to download Node.js from the official website.

Q3. What is the role of npm in Express.js setup?
npm (Node Package Manager) is used to install Express.js and other dependencies. It manages packages for your project. You use npm init to create a package.json file, and npm install express to add Express to your project. npm also helps in running scripts and managing project dependencies.

Q4. How do you create a package.json file?
Run npm init in your project folder. It will ask questions about your project (name, version, description, etc.) and generate a package.json file. You can also use npm init -y to create a default package.json file without the interactive prompts.

Q5. What is the purpose of package.json in an Express project?
package.json is the manifest file for your project. It lists all dependencies (like express), scripts (like start or dev), metadata about the project, and helps in sharing and deploying the project. Anyone cloning your project can run npm install to install all listed dependencies.