Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (33 sloc) 1.4 KB

Joseki.jl

Suggested opening moves for build APIs in Julia with HTTP.jl.

Contents

Introduction

Want to make an API in Julia but not sure where to start? Newer versions of HTTP.jl have everything you need to build one from scratch, but getting started can be a bit intimidating at the moment. Joseki.jl is a set of examples and tools to help you on your way. It's inspired by Mux.jl and Express.

You can see a simple example in the main Readme.md file.

Basics

Joseki.server(endpoints::Array{Tuple{T, String, String}, 1};        middleware=default_middleware, error_fn=unhandled_error_responder) where {T<:Function}
stack(fns::Array{Function, 1}, endpoint::Function;               error_fn=unhandled_error_responder)

Middleware

Joseki.add_cors!(req::HTTP.Request)
Joseki.content_type!(req::HTTP.Request)
Joseki.hit_logger!(req::HTTP.Request)
Joseki.body_logger!(req::HTTP.Request)

Responders

json_responder(req::HTTP.Request, o::T) where {T<:Union{Number, AbstractString, Array, Dict}}
error_responder(req::HTTP.Request, e::String)
Joseki.unhandled_error_responder(req::HTTP.Request,e::Exception)

Utilities

body_as_dict(req::HTTP.Request)

Index

You can’t perform that action at this time.