How to send server-side data to view file in Express?


#1

Hi folks, I’m wondering if it’s possible to send data from the server to the view (HTML) file in an Express app (such as Glitch’s hello-express)?

For example, in Koa, we can do this:

router.get('/', (ctx, next) => {
  return ctx.render('./index', { 
    user: 'eka' 
  })
})

I’ve been looking around for examples of Express apps that do similar thing in server.js (not in client.js) but haven’t found any.

Any help would be appreciated, thanks!