Git Product home page Git Product logo

go-dict2rest's Introduction

dict2rest

A simple proxy service to provide an HTTP (REST) interface to a Dict protocol (RFC 2229) for the Dict protocol. Written in Go.

An instance can usually be access from http://felixhanley.info/projects/lahu/dictionary/

Installation

This project currently uses Golang 1.6's vendor folder structure. All dependencies are in this repository.

It should be as simple as this:

git clone https://github.com/felix/go-dict2rest
cd go-dict2rest
go install dict2rest  # or just 'make'
./bin/dict2rest --dicthost dict.org

The server binary has the following options:

$ dict2rest --help

Usage of dict2rest:
  -deflate
        Support DEFLATE compression
  -dicthost string
        Dict server name (default "localhost")
  -dictport string
        Dict server port (default "2628")
  -gzip
        Support gzip compression
  -port string
        Listen port (default "8080")

Usage

The URL endpoints try to match the commands defined in RFC 2229. Results are JSON and have the following format (newlines added for readability):

GET /databases

[
    {
        "name":"eng-lhu",
        "description":"English-Lahu Dictionary ver. 20160128"
    }, {
        "name":"lhu-eng",
        "description":"Lahu-English Dictionary ver. 20160128"
    }
]

GET /define/{word}
GET /define/{word}?dict=eng-lhu

[
    {
        "dictionary":"WordNet (r) 3.0 (2006)",
        "word":"lahu",
        "definition":"Lahu\n    n 1: a Loloish language\n"
    }
]

Where 'eng-lhu' is one of the names of the server's dictionaries.

RFC 2229 error codes are passed through as JSON:

{"code":552,"message":"no match"}

TODO

  • Add strategy listing and lookups
  • Add server and status commands
  • Add tests

License

Copyright Felix Hanley, 2016

See LICENSE file.

go-dict2rest's People

Contributors

felix avatar pmundt avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pmundt ayys

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.