Skip to content

Instantly share code, notes, and snippets.

@PuercoPop
Last active December 17, 2015 00:09
Show Gist options
  • Save PuercoPop/5518536 to your computer and use it in GitHub Desktop.
Save PuercoPop/5518536 to your computer and use it in GitHub Desktop.
(asdf:defsystem #:qchapi
:name "qchapi"
:description "A Restful Api for Qcha.es"
:author "Javier Olaechea <[email protected]>"
:version "20130401"
:serial t
:license "<3"
:depends-on (#:clack
#:ningle
#:yason
#:postmodern)
:pathname "src/"
:components ((:file "packages")
(:file "qchapi")
(:file "api")
(:file "models")
(:file "tables")
))
(defpackage #:qchapi
(:use #:cl)
(:import-from :ningle :*response*))
(in-package :qchapi)
(defvar *app* (make-instance 'ningle:<app>))
;; Strat, parse json, look for word: argment, then look for definitions.
;; If present then process those, looking for definition field then examples.
;; If present process those
(setf (ningle:route *app* "/word/" :method :PUT)
#'(lambda (params)
(format nil "~a" (gethash "cat" (getf (clack.request:body-parameter ningle:*request*) :json)))))
(clack:clackup *app*)
;; then run curl -v -XPUT -d "{\"cat\": \"dog\"}" http://localhost:5000/word/ from the shell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment