-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Francisco Santos
committed
Sep 27, 2023
0 parents
commit e1b29f6
Showing
9 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Alpaca http library | ||
|
||
Alpaca is a simple and easy to use http library for OCaml. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This file is generated by dune, edit dune-project instead | ||
opam-version: "2.0" | ||
synopsis: "Http library" | ||
description: "Http library" | ||
maintainer: ["ProgramingIsTheFuture"] | ||
authors: ["ProgramingIsTheFuture"] | ||
homepage: "https://github.com/ProgramingIsTheFuture/alpaca" | ||
bug-reports: "https://github.com/ProgramingIsTheFuture/alpaca/issues" | ||
depends: [ | ||
"ocaml" | ||
"dune" {>= "3.10"} | ||
"eio_main" | ||
"eio" | ||
"odoc" {with-doc} | ||
] | ||
build: [ | ||
["dune" "subst"] {dev} | ||
[ | ||
"dune" | ||
"build" | ||
"-p" | ||
name | ||
"-j" | ||
jobs | ||
"@install" | ||
"@runtest" {with-test} | ||
"@doc" {with-doc} | ||
] | ||
] | ||
dev-repo: "git+https://github.com/ProgramingIsTheFuture/alpaca.git" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
(lang dune 3.10) | ||
|
||
(name alpaca) | ||
|
||
(generate_opam_files true) | ||
|
||
(source | ||
(github ProgramingIsTheFuture/alpaca)) | ||
|
||
(authors "ProgramingIsTheFuture") | ||
|
||
(maintainers "ProgramingIsTheFuture") | ||
|
||
(package | ||
(name alpaca) | ||
(synopsis "Http library") | ||
(description "Http library") | ||
(depends ocaml dune eio_main eio)) | ||
|
||
(package | ||
(name test_alpaca) | ||
(allow_empty) | ||
(synopsis "Test http library") | ||
(description "Test http library") | ||
(depends ocaml dune alpaca)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
type request | ||
type response | ||
type handler = request -> response | ||
type methods = [ `Get | `Post | `Patch | `Delete | `Put ] | ||
type route_configs = { methods : methods list } | ||
|
||
type configs = { | ||
port : int; | ||
routes : (string * handler * route_configs option) list; | ||
} | ||
|
||
let route ?(methods = [ `Get ]) path handler = (path, handler, { methods }) | ||
let new_app ?(port = 8000) () = { port; routes = [] } | ||
let router lroutes app = { app with routes = lroutes @ app.routes } | ||
let run _configs = Eio_main.run (fun _env -> assert false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(library | ||
(public_name alpaca) | ||
(name alpaca) | ||
(libraries eio_main eio)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(executable | ||
(name test_alpaca) | ||
(libraries alpaca)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
open Alpaca | ||
|
||
let () = new_app () |> run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This file is generated by dune, edit dune-project instead | ||
opam-version: "2.0" | ||
synopsis: "Test http library" | ||
description: "Test http library" | ||
maintainer: ["ProgramingIsTheFuture"] | ||
authors: ["ProgramingIsTheFuture"] | ||
homepage: "https://github.com/ProgramingIsTheFuture/alpaca" | ||
bug-reports: "https://github.com/ProgramingIsTheFuture/alpaca/issues" | ||
depends: [ | ||
"ocaml" | ||
"dune" {>= "3.10"} | ||
"alpaca" | ||
"odoc" {with-doc} | ||
] | ||
build: [ | ||
["dune" "subst"] {dev} | ||
[ | ||
"dune" | ||
"build" | ||
"-p" | ||
name | ||
"-j" | ||
jobs | ||
"@install" | ||
"@runtest" {with-test} | ||
"@doc" {with-doc} | ||
] | ||
] | ||
dev-repo: "git+https://github.com/ProgramingIsTheFuture/alpaca.git" |