Skip to content

Instantly share code, notes, and snippets.

@droidMakk
Last active May 31, 2017 11:01
Show Gist options
  • Save droidMakk/41cb516d21d93e1b0427d69728fc8620 to your computer and use it in GitHub Desktop.
Save droidMakk/41cb516d21d93e1b0427d69728fc8620 to your computer and use it in GitHub Desktop.
Express simple get request
app.get('/',function(req,res){
//send Json
var js_On = ['One','Two','Three','Four']
res.json(js_On)
res.end()
//send HTML
var html = "<h1>Head</h1>"
res.send(html)
res.end()
//send a file
var file = __dirname+'/public/index.html'
res.sendFile(file)
res.end()
})
@droidMakk
Copy link
Author

A Simple gist for handling response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment