Skip to content
Sign upLog in
← Back to Community

How i can add a node.js file to a html repl???

Profile icon
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
Profile icon
MohdSahil5
Profile icon
lr2l
Profile icon
clement070110
Profile icon
octopyBot
Profile icon
Duvangamer3845
Comments
hotnewtop
Profile icon
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.

Profile icon
Duvangamer3845

@PattanAhmed
im triying but is launch me a wrong

Profile icon
PattanAhmed

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

Profile icon
Duvangamer3845

@PattanAhmed
yeah

Profile icon
PattanAhmed

@Duvangamer3845
:)

Profile icon
Duvangamer3845

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

Profile icon
PattanAhmed

@Duvangamer3845
Ok

Profile icon
Duvangamer3845

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

Profile icon
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

Profile icon
k9chelsea2

wait can you not?

Profile icon
Duvangamer3845

@ironblockhd
xd
thanks

Profile icon
Duvangamer3845

@NDLFOREVER
you can???

Profile icon
k9chelsea2

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

Profile icon
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

Profile icon
Duvangamer3845

@NDLFOREVER

SHOW ME

Profile icon
ironblockhd

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

Profile icon
Duvangamer3845

@ironblockhd
is launch me a wrong

Profile icon
k9chelsea2

Screen Shot 2020-08-03 at 3.08.19 PM


Screen Shot 2020-08-03 at 3.08.07 PM

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

Profile icon
k9chelsea2

ok im prolly wrong lol

Profile icon
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

Profile icon
LightDarkHole

I made a nodejs repl. Then I used websockets and express. Set a static folder with express and make sure to do server.listen and server.get then your done

Profile icon
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.

Profile icon
Duvangamer3845

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

Profile icon
Coder100

send the repl

@Duvangamer3845

Profile icon
Duvangamer3845

@Coder100
https://repl.it/@Duvangamer3845/DimgrayVerifiableBlog#index.js

Profile icon
Coder100

thx

@Duvangamer3845

Profile icon
Coder100

so everything works. What do you want to happen?

@Duvangamer3845

Profile icon
Coder100

ohhh i see. Invite me to your repl

@Duvangamer3845

Profile icon
Duvangamer3845

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

Profile icon
zplusfour

you can simply only write js code in html file!

Profile icon
Duvangamer3845

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

Profile icon
zplusfour

@Duvangamer3845
what is the idea of ur project?

Profile icon
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

Profile icon
zplusfour

@Duvangamer3845
so a website!

Profile icon
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

Profile icon
zplusfour

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

Profile icon
k9chelsea2

oh ok thx