'using handlebars and HTML files together in a Node js project
I am working on a project that has a user login/register system, a QR Code scanner. My goal is to develop a web application. I have made the login/register forms as 'hbs' files and use express to render these files upon request after setting the view engine as 'hbs' in the project. But I want to serve some HTML files running some js script in it too. But when i try to access these html files using the res.sendFile(), it is throwing some error regarding the view engine. Since, i am fairly new to web app development, i have a doubt if i can use both hbs and html files together in an application. I am looking forward to your replies. any help is highly appreciated. Thanks in advance
Solution 1:[1]
You do not need to create .html files in a Handlebars project. You can include the .js file in your .hbs files, the same way you would in an HTML file.
<script src="/js/scripts.js"></script>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | b0bbydev |