Created
November 24, 2015 00:45
-
-
Save natergj/2679f3e0635333b9fdd0 to your computer and use it in GitHub Desktop.
Very basic sample using node's native http module
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
var xl = require('excel4node'); | |
var http = require('http'); | |
http.createServer(function(req, res){ | |
switch(req.url){ | |
case '/download': | |
var wb = new xl.WorkBook(); | |
var ws = wb.WorkSheet('Sheet 1'); | |
ws.Cell(1,1).String('String'); | |
wb.write('Excel.xlsx', res); | |
break; | |
default: | |
res.end('Hello World'); | |
break; | |
} | |
}).listen(3000, function(){ | |
console.log('download file at http://localhost:3000/download'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment