Skip to content

Instantly share code, notes, and snippets.

@rintoandrews90
Created August 11, 2019 13:23
Show Gist options
  • Save rintoandrews90/13a1b65d9be830d796844c6e7b0b0164 to your computer and use it in GitHub Desktop.
Save rintoandrews90/13a1b65d9be830d796844c6e7b0b0164 to your computer and use it in GitHub Desktop.
API GET Methods Node
// npm init -y
//npm install express --save
const express = require('express')
const app = express()
app.get('', (req, res) => {
res.send('Hello Express')
})
// app.com
// app.com/help
// app.com/about
app.get('/help', (req, res) => {
res.send('Help page')
})
app.get('/about', (req, res) => {
res.send('About page')
})
app.get('/wheather', (req, res) => {
res.send('Currenty weather')
})
// http://localhost:3000/
app.listen(3000, () => {
console.log('Server is up on 3000')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment