Skip to content

Tag: node.js

Unable to get __dirname value

I am using __dirname to get absolute path to GraphQL schema: I have changed module to fit ES6 module standard and __dirname now is undefined. How can I resolve path to schema? Answer There is some issue with esm + __dirname https://nodejs.org/api/esm.html#esm_no_require_exports_module_exports_filename_dirname…

How to get brackets value from a document / string in node.js

I am trying to get the value inside the brackets of a string. for example: how am I be able to get the value inside the brackets (job, age and name)? I actually use doctemplater npm to fill data to my document template. But since the template will vary, I need to know which value is required to be inserted

Is this bad practice for res.locals? (Node.js, express)

I was wondering if using res.locals like in this code example is bad practice or if there can occur any problems if you use it this way: Basically I: I verify the session-cookie in app.use (Im using firebase auth) I set the res.locals.userId = userId And then use the local i just set in the app.get (I need to…

how to insert a youtube iframe in a Node JS project? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question I’m doing a project with Node Js and I know very little. I would like…