在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):walmartlabs/lacinia-pedestal开源软件地址(OpenSource Url):https://github.com/walmartlabs/lacinia-pedestal开源编程语言(OpenSource Language):Clojure 97.0%开源软件介绍(OpenSource Introduction):com.walmartlabs/lacinia-pedestalA library that adds the Pedestal underpinnings needed when exposing Lacinia as an HTTP endpoint. Lacinia-Pedestal also supports GraphQL subscriptions, using the same protocol as Apollo GraphQL. Lacinia-Pedestal Manual | API Documentation UsageFor a basic Pedestal server, simply supply a compiled Lacinia schema to
the ;; This example is based off of the code generated from the template
;; `lein new pedestal-service graphql-demo`
(ns graphql-demo.server
(:require [io.pedestal.http :as http]
[com.walmartlabs.lacinia.pedestal2 :as lp]
[com.walmartlabs.lacinia.schema :as schema]))
(def hello-schema
(schema/compile
{:queries
{:hello
;; String is quoted here; in EDN the quotation is not required
;; You could also use :String
{:type 'String
:resolve (constantly "world")}}}))
;; Use default options:
(def service (lp/default-service hello-schema nil))
;; This is an adapted service map, that can be started and stopped.
;; From the REPL you can call http/start and http/stop on this service:
(defonce runnable-service (http/create-server service))
(defn -main
"The entry-point for 'lein run'"
[& args]
(println "\nCreating your server...")
(http/start runnable-service)) Lacinia will handle POST requests at the
You can also access the GraphQL IDE at Development ModeWhen developing an application, it is desirable to be able to change the schema
without restarting.
Lacinia-Pedestal supports this: in the above example, the schema passed to
In this way, the Pedestal stack continues to run, but each request rebuilds the compiled schema based on the latest code you've loaded into the REPL. Beyond default-server
GraphiQLThe GraphiQL packaged inside the library is built using If you are including lacinia-pedestal via Git coordinate (rather than a published version
of the library by using a :mvn/version coordinate), then the library will need to be prepped for use
via The prep action for lacinia-pedestal requires that you have LicenseCopyright © 2017-2022 Walmart Distributed under the Apache Software License 2.0. GraphiQL has its own license. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论