victor-perez/nuxt-helmet

Why is a nuxt module needed to make helmet work in Nuxt?

komplexb opened this issue · 3 comments

Hi Victor,
Thanks for making this.

Can you explain or point me to some documentation that explains why helmet needs to be implemented as a nuxt module instead of being required as express middleware. As in why doesn't placing it in index.js work?

Please let me know thanks.

If you use Express to run Nuxt, you can just use Helmet in your index.js. But by default Nuxt doesn't uses Express, it's using Connect and in that case the easiest way to implement Helmet is nuxt-helmet. I hope that this answer your question

Sorry for the late response.

So if I understand you correctly, the issue is that Helmet is Express middleware, and doesn't natively work with Connext?

@komplexb that is not what I meant. You pointed to the index.js of the express-template when you use this template you can use Helmet directly. But when you do a "normal" Nuxt installation (https://nuxtjs.org/docs/2.x/get-started/installation) then you need to use nuxt-helmet