Ask coding questions

← Back to all posts
How i can add a node.js file to a html repl???
Duvangamer3845

in this moment im working on a website about videogames,but i wanna create a server to the community with node.js but i can't,every try to add a file is only javascript not node.js,can help me some person,i really need this,or i can make a server with a file of only js? repl: https://repl.it/@Duvangamer3845/DimgrayVerifiableBlog#index.js

Answered by PattanAhmed [earned 5 cycles]
View Answer
Voters
lr2l
clement070110
octopyBot
Duvangamer3845
Comments
hotnewtop
PattanAhmed

@Duvangamer3845 Hi,
There is the only way left now!
Create a new Node.js Repl and copy-paste all the code from HTML File to the newly created Node.js Repl.

Hope this helps
Please mark my answer if this helps.

Duvangamer3845

@PattanAhmed im triying but is launch me a wrong

PattanAhmed

@Duvangamer3845 So you cannot launch the Node.js Repl?
Thanks

Duvangamer3845
PattanAhmed
Duvangamer3845

@PattanAhmed this cannot be help for me, i dont know what i wanna know

PattanAhmed
Duvangamer3845

@PattanAhmed i need the answer:how i can make the server now

ironblockhd

You need to create a new nodeJS repl and then copy the html files there, you saddly can't add nodeJS files to existing html repls

k9chelsea2

wait can you not?

Duvangamer3845

@ironblockhd xd
thanks

Duvangamer3845

@NDLFOREVER you can???

k9chelsea2

I don't know, I added a nodejs file to my html repl but I'm not sure if taht worked

Duvangamer3845

@ironblockhd dont work me,the window has not been created in a repl of node.js,the output of the html repl dont see,i wanna create a server with that things,to make a conmunity forum in my page whitout edit the code

Duvangamer3845

@NDLFOREVER

SHOW ME

ironblockhd

you need to put nodejs code to make a simple server, heres how that could look like: https://repl.it/@ironblockhd/VelvetyAdolescentMedian

Duvangamer3845

@ironblockhd is launch me a wrong

k9chelsea2



thats in a html repl, but not running any code because I haven't written any lol

k9chelsea2

ok im prolly wrong lol

Duvangamer3845

@ironblockhd hey? and now what,now i can run mi html pae in the node.js page,but now what,this how can help me to make my server?? this is the output: https://repl.it/@Duvangamer3845/DimgrayVerifiableBlog#index.js that is,in the social page,i wanna make a post box to send something,then i want every user can see that post in that page,like a facebook xd

Coder100

Hi! You will need to create a nodejs repl, and transfer all your code there. Remember, in an HTML repl, all files will be public to the user, and node.js does not exist there.

Duvangamer3845

@Coder100 i can import the node.js package???

Coder100

send the repl @Duvangamer3845

Duvangamer3845
Coder100
Coder100

so everything works. What do you want to happen? @Duvangamer3845

Coder100

ohhh i see. Invite me to your repl @Duvangamer3845

Duvangamer3845

@Coder100 i wanna a social page to share videogames interesting,like the share section on repl.it

zplusfour

you can simply only write js code in html file!

Duvangamer3845

@ZDev1 nope,i cant,the node.js code dont present a output in the html file

zplusfour

@Duvangamer3845 what is the idea of ur project?

Duvangamer3845

@ZDev1 totally,is a page for videogames but the reason to want use node.js its make a conmunity forum when everyone can share his interesting

zplusfour

@Duvangamer3845 so a website!

k9chelsea2

js and nodejs use the same files I think go to a nodejs repl make a new file and you will see it is JS

zplusfour

@NDLFOREVER it is js but the kind of the js is nodejs

k9chelsea2

oh ok thx