GithubHelp home page GithubHelp logo

axllind / libwebb Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 120 KB

A small HTTP server framework in C

License: MIT License

Makefile 4.36% C 95.45% Shell 0.19%
c c99 http http-server web-framework

libwebb's Introduction

libwebb

libwebb (webb is web in Swedish) is a small http server framework written in pure C99 with zero dependencies (for POSIX systems).

Usage

The basic usage of the library is as follows:

#include <string.h>
#include "webb/webb.h"

int http_handler(const WebbRequest *req, WebbResponse *res) {
  // implement behavior given the HTTP request...
  if (req->method != WEBB_GET)
    return 404;
  webb_set_body_static(res, "hello world", 11);
  webb_set_header(res, "content-type", strdup("text/raw"));
  return 200;
}

int main(void) {
  // do some setup...
  return webb_server_run("8080", http_handler);
}

For API documentation, see the library header file. The API is fully documented using doxygen comments.

See ./bin/webb.c for a small web server using the framework.

Compilation and installation

make build              # build the library
cp out/libwebb.a  $DIR  # copy the lib to your destination
cp out/libwebb.so $DIR  # or the dynamic library

# compile against the library and include the header path
gcc ... $DIR/libwebb.a  -I$LIBWEBB_DIR/include
gcc ... $DIR/libwebb.so -I$LIBWEBB_DIR/include

Development

libwebb uses make as it's build system. The makefile is self-documenting. Simply type make to get help about available commands to use to build, lint, and test during development.

libwebb's People

Contributors

axllind avatar

Watchers

 avatar

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.