Hi,
How do I serve images from nodejs / Express to angularjs with permission?
In my router controller I've have the following lines:
export function getLogo(req, res) {
fs.exists(config.repoLogos+'/'+req.params.file, (exists) => {
if (exists){
res.sendFile(config.repoLogos+'/'+req.params.file);
} else {
res.sendFile(config.repoLogos+'/logodefault.png');
}
});
And I get image in controller of angular with:
funciton getLogo(){
return '/api/resources/logo/' + (this.client.logo || 'default';
}
And the template:
<img ng-src="https://github.com/%7B%7Bcdc.getLogo()%7D%7D" class="img-responsive img-thumbnail img-logo center-block" title="Logo">
Any idea??
PD: I'm sorry for my english. :-P