Loading


How do I setup a basic Express JS server? . The Complete Express JS Developer Course 2023 [Videos].

Express JS is a minimal and flexible Node.js web application framework that provides a robust set of features to develop web and mobile applications. It facilitates the rapid development of Node based Web applications.

Installing

Assuming youve already installed Node.js, create a directory to hold your application, and make that your working directory.

$ mkdir myapp
$ cd myapp

Use the npm init command to create a package.json file for your application. For more information on how package.json works, see Specifics of npms package.json handling.

$ npm init

This command prompts you for a number of things, such as the name and version of your application. For now, you can simply hit RETURN to accept the defaults for most of them, with the following exception:

entry point: (index.js)

Enter app.js, or whatever you want the name of the main file to be. If you want it to be index.js, hit RETURN to accept the suggested default file name.

Now install Express in the myapp directory and save it in the dependencies list. For example:

$ npm install express --save

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

$ npm install express --no-save

By default with version npm 5.0+ npm install adds the module to the dependencies list in the package.json file; with earlier versions of npm, you must specify the --save option explicitly. Then, afterwards, running npm install in the app directory will automatically install modules in the dependencies list.

See All

Comments (71 Comments)

Sir Abdul Majid
2021-06-21 16:09:18

source code Click for download attachement


Submit Your Comment

See All Posts

Related Posts

Express JS / Youtube

What is Express JS application?

Express is a minimal and flexible Node.js web application framework that provides a robust set of features to develop web and mobile applications. It facilitates the rapid development of Node based Web applications.
18-Feb-2021 /5 /71

Express JS / Youtube

How do I setup a basic Express JS server?

Express JS is a minimal and flexible Node.js web application framework that provides a robust set of features to develop web and mobile applications. It facilitates the rapid development of Node based Web applications.
21-Jun-2021 /5 /71

Express JS / Youtube

How does REST API connect to MongoDB?

Express is a minimal and flexible Node.js web application framework that provides a robust set of features to develop web and mobile applications. It facilitates the rapid development of Node based Web applications.
23-JUN-2021 /5 /71