Hi I am trying to use Express EJS Layouts in my app. As soon as I try to app.use(expressEjsLayouts) it throws an error. Without it the application works perfectly fine but I’d like to make use of ExpressEjs-Layouts for my templates. Please be kind I am fairly new to coding 🙂 I’ve looked through many posts already but couldnt find
Tag: express
Appended data to formData in node.js…the data which i am posting to my api is always showing null?
Recently I was trying to append a lot of HTML form values to MongoDB database through an async process this const createproperty are my MongoDB fields which i have taken in an array .. these ids are some id’s from the HTML form which i have put in an array this newproperty will give me the values from the Html
How to access the into PUG passed object inside of an inline script without converting
Is it possible to access the whole object, which is passed into PUG, inside of an inline script without converting it with !{JSON.stringify(object)}; Using !{JSON.stringify(events)}; converts existing date-objects to strings, which than needs to be converted back. Wanted behavior: Answer Is it possible to access the whole object, wich is passed into PUG, inside of an inline script without converting
How to get only key and value from stringifying json after API fetch?
I’m trying to display only the key and value on an EJS page. leaves me with How could I remove the brackets and quotations? Here is my server.js route if that helps: Answer Maybe you need just to remove all quotes and single quotes? For this reason, You don’t need to iterate through Object.
node js schedule cron job to call express route every week
I have a page that when you access it, it runs tests. I want my tests to run every week so Im trying to create a cron job that access my express route every week. Sort of like Im making a get request. For testing sake I have a cron job that runs every 2 minutes: If I go in
Node Express sending image files with JSON as API response
How do you send json together with an image file in express? I understand you serve an image using res.sendFile But then what if you want to include json with the image? For example if you are serving a user’s profile data- name, info, etc and profile image. You can’t do and res.send(json). So how do you send both? Answer
Get a value from a callback in another function NodeJS
I’m desperately trying to recover the value of a callback function but I have no idea how to do that. I have a function where I execute this code: Who performs this function: And which is called by this variable: I would like my `authentication’ variable to take the value returned in the callback, and I have no idea how
How to wait for new information from a node.js server
so i am making a small chat lobby project. But im having issues with getting the messages people are sending to the server, back to the clients to show them on the site. It kind of worked using a loop like this: However this is obviosly really bad, and if you started spamming, or too many clients joined, it overloaded
Sending info and variables between Client-Side and Server-Side
so I have an express.js server, I don’t quite understand how I can send and receive I have (for example) an input for someone to write his email , I want the email to be sent to the server, validated, and then an email function sends an email to that user, However, my issue is that I don’t know how
Node.js express – body of POST request is always empty
I am trying to read the body of POST request using Express in Node.JS framework. I send a HTTP POST request using HTML form. I detected a POST request on WireShark with the following data: This shows that the request is sent successfully. I expected JSON format, which is the one that Express successfully parsed for me, but this format