I want have a code that creates a text based on user's given number and i want to different icons/images to this too.
The images are saved in my folder public/images.
I want to not use any client-side javascript, so without document.getElemntyById etc. . I thought if it's possible to pass an image when i render an page:
app.get("..", function(req,res){ res.render("page1",{ image: image} //(or use image url) and then in my pug:
p MY IMAGE: #{image} or
img(src="#{imgURL}") I'm pretty sure second one should work but it doesn't load the image...
So my question how can i achieve the way i just described without client-js? And if its not possible how can i achieve this other way?
btw i have two javascripts, one app.js where i get post/get requests (there i also require my second js) and second one to change number into text and image:
transformNumber.js:
export.modules = { numberToText: function(number){ var text; switch(number) case 2: text = "example"; return text;}, numberToImage: function(number){ var image; switch(number) case 1: image = "example image/imageURL"; return image;}