Skip to content

digital-nomad8620/Bridges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bridges

Build/Test

Introduction

Bridges is an educational project to implement a Http/s server. This project is still in its very early stages of development.

Goals

  • Deploy a website with the Bridges executable and a config file similar to Apache or Nginx.
  • Provide a high level framework for creating websites via the Bridges API.

Ideally, to create a very simple website with the API it would look something like this:

#include <bridges/server.h>

int main(void)
{
    using namespace bridges;

    Server server;

    server.set_root("/var/www1");

    server.route("/", GET, [](const Request& request, Response& resp){
        resp.set_content("index.html");

        return Status::OK;
    })

    server.route("/update", GET|POST, [](const Request& request, Response& resp) {
        if(request.method() == GET)
        {
            resp.set_content("some_page.html");
        }
        else
        {
            std::string item = request.data["item"];
            int quantiy      = request.data["quantity"];

            // Do something with post parameters

        }
        return 200;
    }

    server.listen("localhost", 8000);
}

This sample code would deploy a server that will listen on localhost:8000 whose document root is the /var/www1 folder and the home page is 'index.html' with a '/update' post endpoint.

Prerequsites

Usage

Getting the source code and submodules

git clone https://github.com/AlexanderJDupree/Bridges.git
cd Bridges
git submodule update --init --recursive

Building source code and execute unit tests

Requires cmake

mkdir build
cd build && cmake ..
make install

The tests binary will be in bin/tests/ Bridges binary will be in bin/

Contributing

All contributions are welcome: bug fixes, recommendations, issues, features.

Plase see the issues before you submit a pull request or raise an issue to avoid duplication.

To contribute to this repository:

git clone git@github.com:<YOUR_USERNAME>/LinkedListsCPP.git
  • Create a new branch with a descriptive name:
git checkout -b descriptive_branch_name
  • Write some code, fix something, and add a test to prove that it works.

  • Commit your code and push it to GitHub

  • Open a new pull request and describe the changes you have made.

  • We'll accept your changes after review.

Simple!

What's in this Repo?

Built With

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

HTTP/S Server and Library for C++

Resources

License

Stars

Watchers

Forks

Packages

No packages published