Skip to content

Instantly share code, notes, and snippets.

@kimschles
Last active June 15, 2018 22:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimschles/91159d4c5268b4139da690118e6cdf49 to your computer and use it in GitHub Desktop.
Save kimschles/91159d4c5268b4139da690118e6cdf49 to your computer and use it in GitHub Desktop.
Simplest Express Server
  1. Make a directory
  2. Change into the directory
  3. Create a file called index.js
  4. Install the Express package with npm install express
  5. Copy and paste the Express Server Code
  6. Run your server with node index.js
  7. Look at what's being served up at localhost:3000
  8. Make a change to serve JSON instead of text

change app.get('/', (req, res) => res.send('Hello World!')) to

app.get('/', (req, res) => res.json({message: 'Hello World!'}))

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