Is a file system required to make an http web service?

Hi there! I have a question pertaining to the http web server example freeRTOS provides.
I would give a link, but new users cannot do this. It’s the one underneath TCP and FAT examples.
I noticed it uses an SD card to store the http files and lots of other examples online do this as well. My question is basically why? Is it not possible or undesirable to use the internal memory of the microcontroller? And furthermore, if it is possible to put html files directly into the program memory, then how the heck does that work? Would I need to format a portion of the program memory to act as a file system? How would I store and access the html files?

Thanks in advance! I have so many questions and no other professionals to consult.

I think the biggest part is that a HTTP request includes a “resource” to request from the server, and a file system is the simplest way to express an assortment of resources to provide (if the content is mostly static).

Do you know if a file system is required? Or is it just really difficult not to have a file system, but still possible?

It is definitely not impossible. Other network middleware packages such as Kadak’s KwikNet have used things like virtual file systems that contain the HTML templates to be filled with the dynamic info at run time. As Richard pointed out, a file system is a somewhat natural way to represent Web page contents, so when present, it is generally the first choice.

Thank you so much for the information! One last question… If I wanted to put a file system on my microcontroller, what’s a good way to do it? Do I format part of the program memory to be a small file system? I’ve never done anything like that before. What are the basics to get started with that?

Have you tried FREERTOS+FAT? I haven’t used it yet, but it is supposedly fairly stable.

In the past I had used several middleware file system packets, both free/OS and commercial. The one recommendation I have whichever one you choose is to test it well under fringe conditions, ie fill it up to the rim and see what happens.

You can have const strings that hold the HTML built into your application code, if the pages are fixed, then have file requests find the correct string.

1 Like

I thought FreeRTOS+FAT needed an SD card??? Can you choose where the file system goes? Would be great if I could just partition part of program memory.

Hi Giselle,

according to this here documentation, FreeRTOS+FAT can also be backed by a NAND flash chip or purely in RAM, but I’m sure someone with more first hand experience will chime in and clarify.