Skip to content

Instantly share code, notes, and snippets.

@RachelSa
Created December 11, 2017 17:33
Show Gist options
  • Save RachelSa/f45da3ce0fcb67c0bc6fc91129b1a0db to your computer and use it in GitHub Desktop.
Save RachelSa/f45da3ce0fcb67c0bc6fc91129b1a0db to your computer and use it in GitHub Desktop.
const express = require('express')
// import the Express module
const app = express()
// create an Express application that has Express' built-in functionality, such as routing
app.get('/', (req, res) => res.send('Hello World!'))
// define a route (this one is a GET request to 'domainname.com/', in this case, 'localhost:3000/'. When the request is recieved, it will respond with the string "Hello World!")
app.listen(3000, () => console.log('Example app listening on port 3000!'))
// this defines the port that the server should run (3000) and logs that it's running. By running this file (' node filename.js'), the server will start, and you'll see 'Hello World!' by visiting localhost:3000/.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment