einstein
einstein

Reputation: 13850

I wonder how to executue JS inside a HTML doc on the server

In php you use <?php ?> to execute php code inside an html doc. How do you do that in Nodejs

Upvotes: 1

Views: 80

Answers (3)

Nithin
Nithin

Reputation: 395

you can use the template jade useing express framework for nodejs. https://github.com/visionmedia/jade#readme

Upvotes: 0

Man Programmer
Man Programmer

Reputation: 5356

if template engine is ejs then <%- nameofvariable %>

Upvotes: 1

karaxuna
karaxuna

Reputation: 26930

You should use template engine. See ejs, or jade for example.

http://embeddedjs.com/

http://jade-lang.com/

If you are using Express nodejs framework, then it is very comfortable to use jade. There is also template engine called Bliss which is like Razor Engine in ASP.NET

Upvotes: 1

Related Questions