Skip to content

Instantly share code, notes, and snippets.

@briansunter
Created February 7, 2021 04:08
Show Gist options
  • Save briansunter/0322aa7188cde65304041540715be615 to your computer and use it in GitHub Desktop.
Save briansunter/0322aa7188cde65304041540715be615 to your computer and use it in GitHub Desktop.
express-hello.js
const express = require('express');
const app = express();
app.get('/', (req, res) => {
return res.send('Received a GET HTTP method');
});
app.post('/', (req, res) => {
return res.send('Received a POST HTTP method');
});
app.put('/', (req, res) => {
return res.send('Received a PUT HTTP method');
});
app.delete('/', (req, res) => {
return res.send('Received a DELETE HTTP method');
});
app.listen(3000, () =>
console.log(`Example app listening on port ${process.env.PORT}!`),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment