Member-only story

How to setup a Node.js server port — Part 1

Aneeqa Khan
2 min readOct 12, 2022

What is 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.

Today I want to show you a setup of the node server port so let's get into the implementation.

Install Node and npm

First, you have to download Node and npm from these links.

Get package.json file

Create a folder with your app name and create a file with server.js in that folder.
Now navigate into that folder and type the below command in the terminal.

npm init

It will ask you to provide the version, description, etc to type for your project. Just make sure to add server.js file for the entry point.

Install dependencies

Next, you have to install express which is the Node.js framework to create RESTful APIs and mongoose which is a JS library to create a connection between MongoDB and Node.js app.

npm i express mongoose

--

--

Aneeqa Khan
Aneeqa Khan

Written by Aneeqa Khan

I’m a frontend web and mobile developer specialized in web/mobile designs and frontend frameworks. I usually work with React, React Native, Next and TypeScript.

No responses yet