# Getting Started With Express.js

# Express

Express.js is a popular Node.js web application framework that allows developers to easily create server-side web applications. In this blog post, we will go through the basics of getting started with Express.js by building a simple "Hello World" application.

# Installing

First, we will need to install the Express.js package. This can be done by running the following command in your terminal:

```bash
npm install express
```

Once the package is installed, we can create a new JavaScript file for our application. In this example, we will call it "app.js".

# Creating our first route

```javascript
const express = require("express"); //ie export
const app = express();

//creating route
app.get("/", (req, res) => {
  res.send("Hello World");
});

//listening
app.listen(3000, () => {
  console.log("Server running on port 3000");
});
```

In the code above, we are requiring the Express.js module and creating a new Express application by calling the express() function. We then define a route for the root URL ("/") that will handle a GET request. When a user visits the root URL, our callback function will be executed, which sends a "Hello World" message back to the user.

Finally, we are telling the application to listen on port 3000 for incoming connections.

# Running our Application

To run the application, we can simply execute the following command in the terminal:

```bash
node app.js
```

and then visit [`http://localhost:3000`](http://localhost:3000) in a web browser. It should show "Hello World"

This is just the beginning of what you can do with Express.js. You can also easily define other routes, use middleware, and handle different types of HTTP requests. Happy coding!
