zephyr/samples/net/sockets/civetweb
Torsten Rasmussen 407b49b35c cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
..
src samples & tests: Correct main() type 2019-12-16 11:27:56 +01:00
CMakeLists.txt cmake: use find_package to locate Zephyr 2020-03-27 16:23:46 +01:00
README.rst Samples: net: civetweb: add README 2019-08-16 11:37:54 +02:00
prj.conf samples/net: civetweb: Remove SOC_SERIES_SAME70=y in prj.cnf 2019-11-27 15:18:31 -05:00
sample.yaml

README.rst

.. _sockets-civetweb-sample:

Civetweb sample
###############

Overview
********

This sample application uses the HTTP APIs provided by the external `Civetweb <https://github.com/civetweb/civetweb>`_ module to create an HTTP server demonstrating selected Civetweb features.
The Civetweb module is available as a west :ref:`module <modules>`.

The source code for this sample application can be found at:
:zephyr_file:`samples/net/sockets/civetweb`.

Requirements
************

- A board with hardware networking
- The Civetweb module (made available via west)

Building and Running
********************

This sample was tested on the Atmel SAM E70 Xplained board, so this is the recommended target.

Build it with:

.. zephyr-app-commands::
   :zephyr-app: samples/net/sockets/civetweb
   :board: sam_e70_xplained
   :goals: build
   :compact:

The sample application uses a static IP configuration.

After flashing the board, the server can be accessed with the web browser of your choice at ``10.0.0.111:8080``.

The sample does not serve any files like HTTP (it does not use any filesystem).
Instead it serves the following three URLs:

- ``/`` - a basic hello world handler
- ``/info`` - shows OS information, uses the JSON format to achieve that
- ``/history`` - demonstrates the usage of cookies

A regular 404 status code is returned when trying to access any other URL.

The IP configuration can be changed in Zephyr config.
The default port can be changed in the sources of the sample.