v3.4.4

# Serving Pages from ROM

To enable GoAhead to be used on embedded systems without file systems, GoAhead supports the compilation of web pages and configuration files into C code that can be stored in Read-Only-Memory (ROM) and fetched by GoAhead to respond to relevant requests.

GoAhead has a virtual file system interface that allows the run-time switching between serving web pages on a disk-based file system and a compiled ROM based store of web pages. This ROM facility may also be used to enhance security by preventing the modification of web documents, or in performance critical situations were the serving of web pages from memory may be an effective optimization.

## Compiling Web Pages

The GoAhead webcomp program is used to compile web documents, configuration files, and any other files that you would like to be compiled into C code. The webcomp program will parse the files and convert them into C data structures which can then be compiled by your C/C++ compiler and linked into your application.

For example:

    find web -print >fileList
    webcomp filelist >romFiles.c

This will create a list of all the web files and then convert these files into C structures in the file romFiles.cpp.

The webcomp program takes one options:

Switch | Description
--- | ---
--prefix | Specifies a prefix to remove from each of the compiled file names.

It is important to include some essential GoAhead configuration files into the ROM. These include the GoAhead configuration file, the mime.types file, and any authorization database files. The following script is used to compile the web pages in three web directories ("sslWeb", "vhostWeb", and "web") and to also compile the essential configuration files. Note: the files should be relative paths without a "./" prefix.

    find sslWeb vhostWeb web -print >rom.files \
    echo -e '.\ngoahead.conf\nmime.types\nusers.db\ngroups.db' >>rom.files
    webcomp rom.files >romFiles.c

© Embedthis Software, 2003-2014. All rights reserved.