Categories > Coding > Javascript >

Why do i like EJS?

Wabz

Winning.js

Posts: 2410

Threads: 194

Joined: Apr, 2020

Reputation: 27

Posted

Warning: I am not a pro at EJS i barely know how to use it but it's pretty straight forward if you know Javascript/NodeJS.

 

What is EJS: Well their website says it's embedded Javascript templating but from what i understand you can mix Javascript code with html to make cool things in it without using something like jquery.

https://ejs.co/

 

1. You don't have to learn the syntax.

EJS is basically the HTML syntax with some EJS stuff. The EJS syntax is <% stuff here %> in which you can put some NodeJS code.

 

2. It is easy to use.

With Node and Express, you just need to do npm install ejs then it's installed. then you wanna do app.set('view engine', 'ejs'). Your ejs needs to be in a folder called views but i won't explain everything you can read the docs of express and ejs

 

3. Not vulnerable to XSS (al least with render function)

When you use the render function, it expects to get a string, not html code so it won't do XSS

https://gyazo.com/2944bc0fe437ff96209319d2015a0fc9

 

 

  • 0

My new discord is Wabz#1337 with ID 777154062789509130

davidTube

not inactive

noticed

Posts: 1849

Threads: 88

Joined: Dec, 2018

Reputation: 56

Replied

thats nice! :D

  • 0

Wabz

Winning.js

Posts: 2410

Threads: 194

Joined: Apr, 2020

Reputation: 27

Replied

@davidTube Thanks!

  • 0

My new discord is Wabz#1337 with ID 777154062789509130

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )