Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a REST API for the language app #22

Open
3 of 4 tasks
oubiwann opened this issue Aug 30, 2018 · 1 comment
Open
3 of 4 tasks

Create a REST API for the language app #22

oubiwann opened this issue Aug 30, 2018 · 1 comment

Comments

@oubiwann
Copy link
Member

oubiwann commented Aug 30, 2018

  • Route definitions
  • Request handlers
  • Response data transformations
  • Utilize the lang component (in particular, the db connection)

Depends on #23

@oubiwann
Copy link
Member Author

Possible routes:

;; for the following, support query parameters for providing your own language frequencies data 
;; structure ... for all, support word, sentence, and paragraph parameters
/api/language/gen/assembled 
/api/language/gen/assembled/:world ; if lang is not provided, return results for all
/api/language/gen/assembled/:world/:lang
;; for the following, support query parameters word, sentence, and paragraph
;; if language is not provided, return results for all
/api/language/gen ; return both markov and syntagmata
/api/language/gen/markov
/api/language/gen/syntagmata
/api/language/gen/:lang
/api/language/gen/:lang/markov
/api/language/gen/:lang/syntagmata
;; if race/name are not provided, return results for all
/api/language/gen/name 
/api/language/gen/name/markov
/api/language/gen/name/syntagmata
;; if name-type is not provided, return results for all
/api/language/gen/name/:race
/api/language/gen/name/:race/markov
/api/language/gen/name/:race/syntagmata
/api/language/gen/name/:race/:name-type 
/api/language/gen/name/:race/:name-type/markov
/api/language/gen/name/:race/:name-type/syntagmata
;; stats downloads as JSON data
/api/language/stats/:lang/markov
/api/language/stats/:lang/syntagmata
/api/language/stats/:race/:name-type/markov
/api/language/stats/:race/:name-type/syntagmata
;; for the following, use HTTP verbs for updates, additions, deletes, etc. 
/api/language/dictionary/:lang
;; dedicated search resource
/api/language/dictionary/:lang/search

In all cases, if word, sentence, or paragraph parameters are not provided, then word will be assumed.

All resources should provide a /help companion resource that should return the docstring for the associated operation's docstring (probably the handler). Formats supported should be .md (default), .txt, and .html

Note that the inclusion of language in the routes is necessary, since this will ultimately be pulled into a deployment that offers the combined REST APIs from multiple hexagram30 projects, each with their own /api/something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant