# Working with Express

Express is a [Node.js](nodejs.org) web Framework for building and networking services and applications.
Express is a fast, unopinionated minimalist web framework for Node.js. With its various features, it makes it easy to develop web applications that are very fast  and shorter build time than node.js
It's based on the Node.js middleware module called connect which in turn uses the HTTP module. So, any middleware which is based on connect will also work Express.js.

Advantages of Express.js

1. It's easy to configure and customize.
2. Makes it easy to develop Node.js applications.
3. Based on HTTP methods and URLs Express allows for defining application routes
4. Express has middleware that can be used to perform additional tasks on request and response
5. It's easy to integrate with different template engines
6. Allows defining of error handling middleware
Serving static files and resources of the application is easy
8. Allows for the creation of the REST API server.
9. Easy database connecting

Installation
You can install Express into any project with Npm(node package manager)

```
*npm install express --save* or 
*yarn add express*
```
 Yarn creates a *package.json* file when starting a new project from scratch ,to create it run ```
npm init
```  if its a new project from scratch

Sample Express web server
```
const express = require('express')
const app = express()

app.get('./',(req,res) => res.send ('congratulations you just created your first serve'))
app.listen(3000, () => console.log('Server ready'))
 
``` 
save the  above file to index.js file in the root folder, start the server using 
```
node index.js
```
open the browser to port 3000 on the localhost and you  should see 
"congratulations you just created your first server"

In the above example we import express package to express value 

 we instantiate an application by calling the appp() method
we then tell the application to listen for a get request on the / path and port 300

