P5.js // node server not working


#1


Here I thought I copied these two videos exactly and it worked all the way until this moment of the second video.

here is what I am seeing:


#2

BUMP
Still no answers


#3

Hmm, since you’re getting 404s I would check how you set up express / static content serving. If you could post your app.js or server side code that would help :slight_smile:

Do you have something like this in your server app?:
app.use(express.static('public'))

And a directory called public?:
So you might have something like:

  • public/p5.min.js
  • public/addons/p5.dom.min.js
    Etc

I’m just stabbing in the dark here, but this might help https://expressjs.com/en/starter/static-files.html


#4

http://s000.tinyupload.com/?file_id=98188583476515935874


#5

I removed the libraries but it still did not work


#6

this screenshot should hopefully show everything & clear things up :slight_smile:

more specifically, the ordering of your app.listen() and app.use() was wrong, you have to assign all the middlewares & handlers before you call app.listen()


#7

still some issues… getting 404’s and it says:
Cannot Get /


#8

are your p5js files, inside of a directory called public? (…you asked express to server out all of the files in the public folder statically)

see this file hierarchy:
38%20PM


#9

I would like to post the whole folder but I do not know how I do not have p5.min.js or package lock json


#10

package.lock is auto generated from NPM, you may or may not have it. It shouldn’t effect your ability to run the server.

also, you might not need the p5.min.js depending on how your project is organized.

when you boot your server in your terminal, what do you get back? do you get any errors, or does it only read “my server is running” ?

if you are getting errors, perhaps you can relay them here.