Git Product home page Git Product logo

arduinohttpserver's Introduction

ArduinoHttpServer

Codacy Badge Build Status Code Climate Test Coverage

Server side minimalistic Object Oriented HTTP protocol implementation for the Arduino platform.

ArduinoHttpServer is a simple HTTP request and reply implementation targeted for the embedded Arduino framework. The implementation parses an HTTP request/reply reading/printing from/to any Stream (either Serial or Wifi/Ethernet).

What you do with the request or what you reply is entirely up to your imagination. Very little implicit behaviour.

Quick start

Reading an HTTP request from some Stream instance

// This example uses the Stream instance Serial, might also be a WifiClient object.
// Reserve 511 bytes for body content storage.
ArduinoHttpServer::StreamHttpRequest<511> httpRequest(Serial);
bool success(httpRequest.readRequest())
if (success) // If no HTTP parsing error or read timeout occurred.
{
   // See interface api for other methods.
   const char *body( httpRequest.getBody() );
   // Retrieve 4th part (index is zero based) of the resource URL.
   // E.g. state from: "/api/sensors/1/state"
   const String& restFunction( httpRequest.getResource()[3] );
}

Writing an HTTP reply to some Stream

ArduinoHttpServer::StreamHttpReply httpReply(Serial, "application/json");
httpReply.send("{\"All your base are belong to us!\"}");

Documentation

Documentation available in the ArduinoHttpServer Github wiki

Characteristics

  • HTTP parser with protocol validation.
  • Puts you in control on how to react on a HTTP request; no implicit behaviour.
  • Customizable memory footprint for caching returned body data.
  • No external dependencies outside of the standard Arduino framework.
  • Object oriented implementation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.