Hello,
I'm trying to run the restful_server example in idf4.4. I can build the program but get the following in the output window:
Make Error at main/CMakeLists.txt:10 (message):
C:/Workspace/Eclipse/restful_server/main/../front/web-demo/dist doesn't
exit. Please run 'npm run build' in
C:/Workspace/Eclipse/restful_server/main/../front/web-demo
Via the command terminal "ESP-IDF 4.4 CMD" I switch to the web-demo dir and run "npm run build". I'm getting the following output:
'npm' is not recognized as an internal or external command,
operable program or batch file.
Can someone explain how to install npm?
Thanks
idf 4.4 restful_server example
Re: idf 4.4 restful_server example
npm isn't used to compile esp-idf stuff. You need to run "idf.py build" from your project directory. Unless I'm confused about the project you're building. If you do need npm, you need to install node: https://nodejs.org/en/
Re: idf 4.4 restful_server example
The rest server example needs a client to exercise it to be a complete example. Espressif has chosen to use a nodejs client as an example. That's the stuff under the "front" subfolder. To build that, you need to install nodejs. `npm` is part of nodejs. It's not part of the ESP32 toolchain, it's a separate thing.
Re: idf 4.4 restful_server example
Ok, thanks for the help. I'll install nodejs and see if I can get it to work.
thanks
thanks
Re: idf 4.4 restful_server example
@bmartin0 you could also install a program like Insomnia or Postman. Either of these would allow you to send a PUT or POST request with the parameters you want to the ESP32 server and see the results. If you want to get into writing a REST interface, I highly recommend getting one of these as a useful tool. Nodejs is just the tool the example uses to send the REST commands, but you could use either of these as well.
Re: idf 4.4 restful_server example
I downloaded nodejs and got it working. I used a browser and set it to the IP on the serial term. It seems to be working fine now. Just need to figure out how it works. Kinda new to this webserver stuff. I get IP 10.0.0.115 and can go to that via chrome and the web page shows up no problem. Just have to study it now as I'm not sure how to take this code and use esp32 values such as real time data I've gathered and post them to this webpage, i.e. use real ad data an update the plot that this code is showing. I think I need an asynchronous webserver but not sure how to get the data pushed to it in a repetitive fashion such as once per second.
This is a big step forward and I really appreciate all the comments and help from all involved.
Thank you very much!
This is a big step forward and I really appreciate all the comments and help from all involved.
Thank you very much!
Re: idf 4.4 restful_server example
If you mean that you want the web page to update automatically based upon data pushed from the ESP32, then you probably want to use websockets. ESP-IDF supports websocket server. The alternative would be to use a timer in the client side javascript to pull the data at regular intervals. The advantage of the websocket is that it can push the data only if and when it changes.
Who is online
Users browsing this forum: Baidu [Spider] and 103 guests