Skip to content

Instantly share code, notes, and snippets.

@rintoandrews90
Created August 11, 2019 13:36
Show Gist options
  • Save rintoandrews90/3a13f4dbdf491773e0476003a4661aaf to your computer and use it in GitHub Desktop.
Save rintoandrews90/3a13f4dbdf491773e0476003a4661aaf to your computer and use it in GitHub Desktop.
Return JSOM/HTML for Get
// 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