Created
April 4, 2016 21:36
-
-
Save AlexanderArmua/0e1b9a270173ddbbcc1752fb2f17a599 to your computer and use it in GitHub Desktop.
Descargar un txt desde html con 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
exports = module.exports = function(app, conf) { //BASE DEL BACKEND | |
app.get('/api/orm-txt/download', function(req, res){ // <a href="/api/orm-txt/download" target="_blank">Descargar</a> | |
var text="Hello World!"; | |
res.set({"Content-Disposition":"attachment; filename=\"test.txt\""}); //Se lo crea como un archivo y se le asigna un nombre | |
res.send(text); //Se envia al usuario | |
}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment