Giter Site home page Giter Site logo

kassane / picohttpasio Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 18 KB

This is a simple HTTP server implemented in C++ using the picohttpparser library for HTTP parsing and the Asio library for network communication.

License: Other

Zig 4.00% C++ 25.74% C 67.64% HTML 0.46% CMake 2.16%
asio cplusplus cpp http-client http-server web

picohttpasio's Introduction

HTTP Server & Client with picohttpparser and Asio

This is a simple HTTP server implemented in C++ using the picohttpparser library for HTTP parsing and the Asio library for network communication. The server can serve static files and return a Hello C++ Server!! response for specific routes.

Prerequisites

Before running this HTTP server, make sure you have the following prerequisites installed:

Building and Running

ollow these steps to build and run the server:

  1. Clone the repository:
git clone <repository-url>
cd picoasio
zig build run -Doptimize=ReleaseFast
# or
cmake -B build -DCMAKE_TYPE_BUILD=Release && cmake --build build --parallel

By default, the server listens on port 8080 and serves files from the ./www directory. You can modify the root directory and other server options in the source code. Usage Serving Static Files

To serve static files, simply place your files in the ./www directory. The server will serve index.html by default when accessing the root (/) URL. Custom Routes

You can create custom routes by modifying the handleRequest method in the HTTPRequestHandler class. For example, to respond with a static Hello C++ Server!! response for the /hello route, you can add:

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

  • The picohttpparser library: Copyright (c) 2009-2014 Kazuho Oku, Tokuhiro Matsuno, Daisuke Murase, Shigeo Mitsunari
  • The Asio library: Copyright (c) 2003-2023 Christopher M. Kohlhoff

Feel free to customize and extend this server to suit your needs.

picohttpasio's People

Contributors

kassane 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.