nadjieb / cpp-mjpeg-streamer

C++ MJPEG over HTTP Library
MIT License
139 stars 39 forks source link

Serve index.html #40

Closed metanav closed 4 months ago

metanav commented 11 months ago

Thank you for the nice library. It is helpful.

How can we serve an index.html from the program?

I tried this but did not work.

    MJPEGStreamer streamer;
    streamer.start(8080);
    streamer.publish("/", "<html><body><h1>Hello</h1></body><html>");
rotolof commented 11 months ago

This library is for serving images as MJPEG streams, if you want to serve HTML files you probably need something else like httplib.

kamalnadjieb commented 11 months ago

Hi @metanav thank you for your compliment and question.

As @rotolof said, this library only responsible to stream images from your C++ application to the web using MJPEG over HTTP mechanism.

To serve the html file, there are many ways to do it depends on your use case. You can search on the internet with keywords "how to run html files on the web".

Maybe you can share your use case here so we can suggest you with possible solutions (although might not go into too much detail since it is not the scope of this library).

Please let me know if you have any questions regarding the usage of this library.

kamalnadjieb commented 11 months ago

Also, thanks @rotolof for answering the question before me.