Best Node.js & Express.js Project Structure
Let's first learn what Node.js & Express.js is and why should you use it?
Node.js
Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on a JavaScript Engine and executes JavaScript code outside a web browser, which was designed to build scalable network applications.
Express.js
Express.js, or simply Express, is a back end web application framework for building RESTful APIs with Node.js, released as free and open-source software under the MIT License. It is designed for building web applications and APIs. It has been called the de facto standard server framework for Node.js.
Now that you have an idea about node.js and express.js lets create a basic project.
Let’s create a folder, navigate to it and run following command on terminal.
npm init -y
You will see a file called package.json after execution of the command.
Now create a file called server.js in the same folder as package.json