To test that, create 'public/main.js' with this line:
alert("I'm a global js file");
And import the file in 'app_modules/home/views/index.pug':
block content
h3 This is my page content
p I love ZinkyJS
script(src="/file/main.js")
Visit localhost:3000
To test that, put any image in 'app_modules/home/client' and import the file in 'app_modules/home/views/index.pug':
block content
img(src="/home/file/imageName.ext")
h3 This is my page content
p I love ZinkyJS
script(src="/file/main.js")
Note: Even if 'home' module is aliased by '', you still have to write '/home/file' if you want to get its static content.
{ statusCode: 404 }
Check the error handling course for further details.
GET_myimage(req, res, next) {
res.sendFile(__dirname + "/client/imageName.ext") // the image you added earlier
}
GET_myimage(req, res, next) {
res.download(__dirname + "/client/imageName.ext", "my_image.ext") // the image you added earlier
}
GET_svg(req, res, next) {
// We'll say, you have a file name 'svg.pug' in 'views'
var content = this.v("svg").render()
res.sendAsFile(content, "svg");
}