NodeJS | Tutorial 1 | Creating your first GET API endpoint

 Welcome to CCP !

Lets get started,


So, Today we will be starting our journey with the epic framework of an epic language: NodeJS

What is NodeJS ?

It is a Javascript library used to program logic of the backend servers,

Basically, it is a server-side library where you can use your javascript skills to build its backend,

How amazing is that !

So in this tutorial, I will be teaching you how to set up a basic server with javascript

Now,
I want you to go to your favorite code editor in your preferred folder and create an "index.js" file


(You can change its name afterward also)

And,

Lets just get right into the code !


I hope you understood ;)

For more info on headers, I suggest you go here

Lets run this program:

To run this program, just write:

node index.js

This should run the program at port 8000 (Specified in the above program)

Now go to your browser and type:

http://localhost:8000/

Or replace the 8000 in the URL with your port number if you wanted to run on another port


Note: If "node" is not installed in your machine, you can go here,

or else everything is fine and you see the message "Server setted up !" on your browser,

Then,

CONGRATULATIONS ! you just created a server on your machine

Now,
Have fun with your VERY OWN server,
I'll see YOU in the NEXT, TUTORIAL !

Comments