Submit templates for repl.it/templates here.

← Back to all posts
Express & Ejs Template
h
RohilPatel (1535)

Express.js Template

What this package includes

  • Ejs in HTML files
  • RenderFile Function
  • Default ejs templates

The RenderFile Function

  • Renders html files as ejs
  • Allows for miltiple ejs templates, quickly, and easy
app.get('/', (req, res) => {
  RenderFile(res, 'filename', {
    key: "value" // pass extra data specifically to "/"
  }
}
<h1><%= key %></h1> 
<!-- Displays "value" on the website -->

ejsData file

  • Used for passing ejsData to all files in router
ejsData.helloWorld = 'hi';
<h1><%= helloWorld %></h1> <!-- Displays "hi" to the website %>
Comments
hotnewtop
EpicGamer007 (1618)

the great thing about this is that now i can finally use emmett while writing html (ejs) files!

EpicGamer007 (1618)

I love how your 4 cycles behind me

RohilPatel (1535)

Haha lol, also ty! Have fun using Emmett! @EpicGamer007

RohilPatel (1535)

Now it's time for me to make something to get more cycles than you lol @EpicGamer007

RohilPatel (1535)

Lol ty. If you need help lemme know @JuanR4140