Fork me on GitHub
#pedestal
<
2019-04-15
>
donaldball01:04:44

I’m doing this by calling graphql-routes instead of service-map, adding it to my other routes, and building my own pedestal service

donaldball01:04:05

You could call service-map with a :routes arg that you build with graphql-routes yourself

sooheon10:04:01

@emccue mine looks like this:

(def extra-routes
  #{["/tasks/update-articles" :get update-articles :route-name :tasks/update-articles]})


(mount/defstate service
  :start
  (let [{profile :profile} (mount/args)]
    (-> schema/footballpedia-schema
        (lp/service-map {:graphiql (not= :prod profile)})
        (update ::http/routes set/union extra-routes)
        (assoc ::http/allowed-origins (if (= :prod profile)
                                        allowed-origins
                                        (constantly true)))
        (assoc ::http/host "0.0.0.0")
        (assoc ::http/port 8080)
        http/create-server
        http/start))
  :stop (http/stop service))