postal
Crystal bindings for libpostal
Installation
-
Add the dependency to your
shard.yml
:dependencies: postal: git: https://codeberg.org/skinnyjames/postal.git
-
Run
shards install
Usage
Example http parsing server
require "postal"
require "http/server"
require "json"
worker = Postal::Worker.new("/opt/geoffrey/embedded/share/libpostal")
server = HTTP::Server.new do |context|
add = context.request.query_params["add"]? || "123 Maine st, Quincy IL 62301"
arr = worker.expand(add).map(&.parsed)
context.response.content_type = "application/json"
context.response.print arr.to_json
end
server.bind_tcp 8081
server.listen
Development
Upcoming
Contributors
- Sean Gregory - creator and maintainer