Last active
May 31, 2017 11:01
-
-
Save droidMakk/41cb516d21d93e1b0427d69728fc8620 to your computer and use it in GitHub Desktop.
Express simple get request
This file contains 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
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() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A Simple gist for handling response