Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

nuxed/http-server

Repository files navigation

Build Status Total Downloads Latest Stable Version License

Nuxed Http Server

The Nuxed Http Server component provides a simple to use Http Server.

Installation

This package can be installed with Composer.

$ composer require nuxed/http-server

Example

use namespace Nuxed\Http\Server;
use namespace Nuxed\Http\Server\Socket;
use namespace Nuxed\Http\Message;

<<__EntryPoint>>
async function main(): Awaitable<void> {
  $options = Server\Options::create();
  
  $socket = await Socket\Server::listen(
    Socket\SocketAddress::create('tcp://127.0.0.1:8000')
  );

  $handler = Server\ch(async($request) ==> {
    $response = Message\Response\text('Hello, World!');
    $response = $response->withCookie('foo', Message\cookie('bar'));

    return $response;
  });

  $server = new Server\Server($options, $handler);  
  $server->listen($socket);

  await $server->run();
}

Security

For information on reporting security vulnerabilities in Nuxed, see SECURITY.md.


License

Nuxed is open-sourced software licensed under the MIT-licensed.

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published