
Join the Conversation!
Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.
"Please login to view comments"
Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.
By logging in, you'll unlock full access to this and other free tutorials on JSM Pro.
Why? Logging in lets us personalize your learning experience, track your progress, and keep you in the loop with new workshops, coding tips, and platform updates.
You'll also be the first to know about upcoming launches, events, and exclusive discounts.
No spam—just helpful content to level up your skills.
If that sounds fair, go ahead and log in to continue →
Enter your name and email to get instant access
##Looks like we found a thief monkey By the way, I liked the trick how you reached till here. You have a good sense of humor. You will improve a lot if you join our course with this passion.
var
(function-scoped, outdated)let
(block-scoped, modern and recommended)const
(block-scoped, cannot be reassigned)_
, or $
let let = 5;
is invalid)myVar
and myvar
are different)string
, number
, boolean
, null
, undefined
, bigint
, symbol
Objects
, Arrays
, Functions
Subscribing gives you access to a brief, insightful summary of each lecture to stay on track.
00:00:02 To start creating our Express server, let's head into the app.js and let's make it work.
00:00:08 We can do it by importing Express from Express.
00:00:13 And then we are ready to initialize our app by saying const app is equal to Express.
00:00:18 And then we call it as a function.
00:00:20 As soon as you do that, you're already ready to create your first route.
00:00:24 You can do that by referring to the app instance and then calling the method of the HTTP call you want to make.
00:00:30 It can be app.post, app.put, or in this case, a simple app.get.
00:00:37 Then the first parameter you pass into it is the path of where this route will be reachable.
00:00:43 In this case, it'll be just forward slash, meaning on the homepage.
00:00:47 And as the second parameter, you can pass a callback function, which typically looks something like this.
00:00:52 An arrow function, where as arguments, you'll have access to the information about the request and the response.
00:00:59 And you can put them to use within this callback function.
00:01:01 What we typically do when we create a new API is just say rest.send hello world.
00:01:08 Or in this case, we can do something like welcome to the subscription tracker API.
00:01:17 Even though you've created your first route, that's not enough to be able to access it.
00:01:21 We have to make our server listen for requests trying to access specific routes.
00:01:26 And you can do that by calling the app.listen method and specify on which port you want to listen.
00:01:32 In this case, we can do something like port 3000. And then you can define a callback function, which will be executed once you run the application.
00:01:41 And there you can just do a console log, say something generic like server running on port 3000, or you can say subscription tracker API is running on
00:01:55 HTTP colon forward slash forward slash localhost colon 3000. This will expose the full URL of where you can access your routes.
00:02:04 And don't forget to run export default app.
00:02:07 With that in mind, let's give it a shot and run our application.
00:02:10 I'll do it by running npm run dev.
00:02:13 You can see that nodemon has started and subscription tracker API is running on localhost 3000. You can click this URL right here,
00:02:21 which will open it up in the browser.
00:02:23 And you can see welcome to the subscription tracker API, which means that our server is active.
00:02:28 Great.
00:02:29 That's a good start.
00:02:30 But in the next lesson, let's set up our environments so we can run this application both locally and in production.