I just started learning Nodejs and I want to use it to handle server side code on my site such as a Log In system
I have a login.html
file with the following code, and a CSS
file referenced to style this page. Here's the HTML
form:
<div id="login">
<form id="loginForm" name="loginForm" action="" method="post">
<input id="username" type="text" placeholder="Username" required><br>
<input id="password" type="password" placeholder="Password" required><br>
<input id="enterBtn" type="submit" name="enter" value="LOGIN" onClick="contactForm(this.form)">
</form>
</div>
Everywhere I've looked so far it seems that I have to use .ejs
files in order to communicate with my server.js
script.
But when I try copy/pasting my login.html
code into a login.ejs
file, but:
- my css doesn't work anymore
- when I ahref my
login.ejs
page from an html page, instead of opening the page, it opens thelogin.ejs
code in the browser instead. Any suggestions? Thank you!