Created
August 11, 2019 13:23
-
-
Save rintoandrews90/13a1b65d9be830d796844c6e7b0b0164 to your computer and use it in GitHub Desktop.
API GET Methods Node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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