1- # Function HTTP server
1+ # Functional HTTP server
2+
3+ Common Functional Programming Algebraic data types for JavaScript that is compatible with most modern browsers and Deno.
4+
5+ [ ![ deno land
] ( http://img.shields.io/badge/available%20on-deno.land/x-lightgrey.svg?logo=deno&labelColor=black )] ( https://github.com/sebastienfilion/[email protected] ) 6+ [ ![ deno version] ( https://img.shields.io/badge/deno-^1.4.6-lightgrey?logo=deno )] ( https://github.com/denoland/deno )
7+ [ ![ GitHub release] ( https://img.shields.io/github/v/release/sebastienfilion/functional )] ( https://github.com/sebastienfilion/functional-http-server/releases )
8+ [ ![ GitHub licence] ( https://img.shields.io/github/license/sebastienfilion/functional )] ( https://github.com/sebastienfilion/functional-http-server/blob/v0.1.1/LICENSE )
9+
10+ * [ Simple HTTP server] ( #simple-http-server )
11+ * [ Routing] ( #routing )
212
313## Simple HTTP server
414
@@ -9,7 +19,7 @@ function that takes a `Request` and return a `Task` of a `Response`.
919``` js
1020import Task from " https://deno.land/x/[email protected] /library/Task.js" ;
1121import Response from " https://deno.land/x/[email protected] /library/Response.js" ;
12- import startHTTPServer from " . /library/server.js" ;
22+ import startHTTPServer from " https://deno.land/x/[email protected] /library/server.js" ;
1323
1424startHTTPServer ({ port: 8080 }, request => Task .of (Response .OK ({}, request .raw )));
1525```
@@ -35,9 +45,9 @@ must return a `Task` of a `Response`.
3545
3646``` js
3747import Task from " https://deno.land/x/[email protected] /library/Task.js" ;
48+ import {
encodeText }
from " https://deno.land/x/[email protected] /library/utilities.js" ;
3849import Response from " https://deno.land/x/[email protected] /library/Response.js" ;
39- import { route } from " ./library/route.js" ;
40- import { encodeText } from " ./library/utilities.js" ;
50+ import {
route }
from " https://deno.land/x/[email protected] /library/route.js" ;
4151
4252startHTTPServer (
4353 { port: 8080 },
@@ -57,9 +67,9 @@ the assertion function. Each handler takes a `String` or a `RegExp` and a unary
5767
5868``` js
5969import Task from " https://deno.land/x/[email protected] /library/Task.js" ;
70+ import {
encodeText }
from " https://deno.land/x/[email protected] /library/utilities.js" ;
6071import Response from " https://deno.land/x/[email protected] /library/Response.js" ;
61- import { handlers , route } from " ./library/route.js" ;
62- import { encodeText } from " ./library/utilities.js" ;
72+ import {
handlers ,
route }
from " https://deno.land/x/[email protected] /library/route.js" ;
6373
6474startHTTPServer (
6575 { port: 8080 },
@@ -78,7 +88,7 @@ The binary function handler will be called with an object containing the origina
7888and other parameters; the second argument is the body of request serialized based on the content type.
7989
8090``` js
81- import { explodeRequest } from " . /library/utilities.js" ;
91+ import {
explodeRequest }
from " https://deno.land/x/[email protected] /library/utilities.js" ;
8292
8393startHTTPServer (
8494 { port: 8080 },
0 commit comments