nodes express simple routing configuration

nodejs Version: 4.6.13

express Framework

1.sendFile()
const path = require('path');

 

res.sendFile(path.join(__dirname+"/../model/build/three.js"));

 __dirname here refers to the current directory js file is located, path is our project directory. ../ it is back to the previous. So this will be able to get any html file you want to send.

 

2.send () 
sends String used

3.download
download file


Guess you like

Origin www.cnblogs.com/JMarshall/p/11518516.html