12.2:将Express与Node结合使用-WebSockets和p5.js教程



在此视频中,我介绍了如何将express.js添加到您的节点应用程序中以提供静态文件。

源代码:https://github.com/shiffman/Video-Lesson-Materials

联系人:https://twitter.com/shiffman

下一个视频:https://youtu.be/HZWmrt3Jy10

节点:https://nodejs.org/en/
Socket.io:http://socket.io/
快递:http://expressjs.com/
p5.j​​s:https://p5js.org/

了解JavaScript基础知识:

有关数据和API的更多信息:

帮助我们字幕和翻译此视频!

http://amara.org/v/Qbsr/

Conduct行为准则:https://github.com/CodingTrain/Code-of-Conduct。

32 comments
  1. it works but then when I update my script.js file it won't update in the browser. Even if I ctrl C in the command line and then node server.js in command line and then refresh browser

  2. Thank you Daniel. Working fine: I saved a model.json but then could not load it in the browser. Running well from localhost… The code can recognize my daughter and my wife by now. will improve including myself and the cats.

  3. For those that are not able to get the ellipse at 10:40 try editing your index.html file by replacing the script lines (not the one with sketch.js but the other ones) to include "libraries/" at the front of the js file in the src attribute.
    i.e. change
    <script src="p5.js"></script>
    to
    <script src="libraries/p5.js"></script>
    repeat with the other lines.

  4. If I use require() in my p5 sketch.js file in the public folder I get an error message in the console saying require is not defined. Is there a way to use require() inside the sketch.js file?

  5. This is so easy to follow and yet so interesting and entertaining! Thank you so much for those great videos!

  6. so I got stuck because I couldnt get javascript to draw stuff when I opened the html page through localhost:3000 (using server.js and express)
    I later realized all the p5 files (p5.js, p5.min.js etc…) also need to be in the public folder, along with the sketch file, for it to actually draw stuff

  7. Does anyone know why I am getting the "Cannot GET /" error on localhost:3000 but my sketch is showing locally if i bring it up and open it as regular URL(saving the html file and then double clicking it)? I have tried using multiple ports as well

  8. oh men, i finally i made my first webpage with p5.js hosted by node.js. thank u sir. if you were my professor in college it will not be boring and dull.enjoy ur video

  9. I listen on port 3000,
    Not much has changed but they live underwater,
    And your great, great, great grand daughter is doing fineeeee

  10. i need help. can you please provide me a guidance. i made an gps traker module but i have some confusion and doubts
    Our GPS Tracking device send data to server through HTTP Protocols in stream.

    after connection establishments, send 19-charterer ASCII string Device ID using HTTP POST request.

    for example: "#863586032468872*#nr"

    after that
    38-charterer ASCII string send every 2 or 3 seconds using HTTP POST request.

    for example: "#22.73688886,#75.88336181,#000,#98*#nr"
    (latitude, longitude, speed, battery status)

    i have search all the way but didn't get perfect solution

Comments are closed.