Linking html files in Node.js

Server.js

..... .....

app.configure(function() {

// map .renderFile to ".html" files
app.engine('html', require('ejs').renderFile);

// make ".html" the default
app.set('view engine', 'html');

app.set('views', __dirname + '/public/views');

......

}

register.html

<form class="form-signup" action="/admin/signup" method="post">
....
....
</form>

login.html

<a class="link-width" href="views/register.html">Register</a>

but clicking the link doesn't work, though i have register.html in public\views\register.html

the below code is working, but i have hardcoded the domain and port which is a bad practice(in future these values might change)

<a class="link-width" href="http://localhost:9090/admin/register">Register</a>

server side

res.render("login", {message : ""});

Thanks in advance.

You can pass site url from app.locals like this WHERE you can pull siteurl from config file:

app.locals({
site_url : cfg.site_url
});

then in view file you can do <%= site_url %>

you need to configure middle-ware to serve static content.

app.use(express.static( __dirname + '/public' ));