Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tokuhirom/p6-http-server-tiny
Web application server for Perl6
https://github.com/tokuhirom/p6-http-server-tiny
perl6
Last synced: about 1 month ago
JSON representation
Web application server for Perl6
- Host: GitHub
- URL: https://github.com/tokuhirom/p6-http-server-tiny
- Owner: tokuhirom
- License: artistic-2.0
- Created: 2015-09-15T23:59:50.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-04-30T14:51:34.000Z (over 6 years ago)
- Last Synced: 2024-10-10T21:40:13.953Z (about 1 month ago)
- Topics: perl6
- Language: Perl 6
- Homepage:
- Size: 205 KB
- Stars: 18
- Watchers: 10
- Forks: 10
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/tokuhirom/p6-HTTP-Server-Tiny.svg?branch=master)](https://travis-ci.org/tokuhirom/p6-HTTP-Server-Tiny)
NAME
====HTTP::Server::Tiny - a simple HTTP server for Perl6
SYNOPSIS
========use HTTP::Server::Tiny;
my $port = 8080;
# Only listen for connections from the local host
# if you want this to be accessible from another
# host then change this to '0.0.0.0'
my $host = '127.0.0.1';HTTP::Server::Tiny.new(:$host , :$port).run(sub ($env) {
my $channel = Channel.new;
start {
for 1..100 {
$channel.send(($_ ~ "\n").Str.encode('utf-8'));
}
$channel.close;
};
return 200, ['Content-Type' => 'text/plain'], $channel
});DESCRIPTION
===========HTTP::Server::Tiny is a standalone HTTP/1.1 web server for perl6.
METHODS
=======* `HTTP::Server::Tiny.new($host, $port)`
Create new instance.
* `$server.run(Callable $app, Promise :$control-promise)`
Run http server with P6W app. The named parameter `control-promise` if provided, can be *kept* to quit the server loop, which may be useful if the server is run asynchronously to the main thread of execution in an application.
If the optional named parameter `control-promise` is provided with a `Promise` then the server loop will be quit when the promise is kept.
VERSIONING RULE
===============This module respects [Semantic versioning](http://semver.org/)
TODO
====* Support timeout
COPYRIGHT AND LICENSE
=====================Copyright 2015, 2016 Tokuhiro Matsuno
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.