Skip to content

Instantly share code, notes, and snippets.

@siddrc
Last active June 10, 2018 05:57
Show Gist options
  • Select an option

  • Save siddrc/fb9b95c2e31326c9c4549e0bc1a6bbf9 to your computer and use it in GitHub Desktop.

Select an option

Save siddrc/fb9b95c2e31326c9c4549e0bc1a6bbf9 to your computer and use it in GitHub Desktop.
Notes for ExpressJS

expressjs

What is Express JS? As per the official website, http://expressjs.com/ expressjs-2

ExpressJs is basically a light-weight web framework, allowing to build server side web applications, it has full capabilities to develop applications that can behave as a server side application or just use to make REST-API.

To begin with we start with $ npm install express --save This adds Express to our project and can be seen in the dependancies section in package.json. http://expressjs.com/en/starter/installing.html

To use express we make changes to our entry point file:

  const express = require("express")
  const app = express()

This loads the express library in express variable. On further drilling down to node_modules folder you can see what is exported from the folder express.

app.listen(8080)

The moment this line is executed, express server is started at the mentioned port. For more reading Please go through http://expressjs.com/en/guide/routing.html
http://expressjs.com/en/4x/api.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment