score:0

solution :

both the backend and frontend code needed to be reworked; the solution is clearly simple.

1.backend :

the filerouter route is no more necessary. express is used. targeted file is in a public/ directory created at the root of the backend directory.

app.js:

express.static.mime.define({'application/x-xpinstall' : ['xpi']})
app.use('/download' , express.static('public'))


2. frontend :

long story short : declare your component then the solution is only html really...

const download = () =>{
return(
    <a href='https://yourwebsite.com/download/yourfirefoxextension.xpi'>
        download the extension
    </a>
)
}

postscript :

the extension is directly installed by firefox after the user accepts it. no need for setting-up an express.router(). i'm still curious to know if the first way i tried had any chance to work (if you feel you have the answer, don't hesitate).


Related Query

More Query from same tag