Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

skinnyjames/postal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

postal

Crystal bindings for libpostal

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      postal:
        git: https://codeberg.org/skinnyjames/postal.git
  2. 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

Releases

No releases published

Packages

No packages published