Ask coding questions

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

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 (1405) [earned 5 cycles]
View Answer
Comments
hotnewtop
PattanAhmed (1405)

@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 (131)

@PattanAhmed im triying but is launch me a wrong

PattanAhmed (1405)

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

Duvangamer3845 (131)

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

Duvangamer3845 (131)

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

ironblockhd (427)

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 (735)

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

Duvangamer3845 (131)

@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

ironblockhd (427)

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

k9chelsea2 (735)



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

k9chelsea2 (735)

ok im prolly wrong lol

Duvangamer3845 (131)

@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 (18104)

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 (131)

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

Coder100 (18104)

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

Coder100 (18104)

ohhh i see. Invite me to your repl @Duvangamer3845

Duvangamer3845 (131)

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

zplusfour (901)

you can simply only write js code in html file!

Duvangamer3845 (131)

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

zplusfour (901)

@Duvangamer3845 what is the idea of ur project?

Duvangamer3845 (131)

@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

k9chelsea2 (735)

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 (901)

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