Created
August 11, 2019 13:36
-
-
Save rintoandrews90/3a13f4dbdf491773e0476003a4661aaf to your computer and use it in GitHub Desktop.
Return JSOM/HTML for Get
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('<h1>Weather</h1>') | |
}) | |
// app.com | |
// app.com/help | |
// app.com/about | |
app.get('/help', (req, res) => { | |
res.send([ | |
{ | |
name:'rinto', | |
age:10 | |
}, | |
{ | |
name:'neil', | |
age:20 | |
} | |
]) | |
}) | |
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