alephjs / aleph.js

The Full-stack Framework in Deno.

Home Page:https://alephjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to build with GraphQL Server?

skorotkiewicz opened this issue · comments

If I build my project, it's output only the Client side without server, how can I build with GraphQL server?
On deno task dev, it's run GraphQL and Aleph Server and it works perfect.

ServeQL(yoga, {
  port: 4000,
});

serve({
  plugins: [denoDeploy({ modules }), react({ ssr: true }), unocss(config)],
  // middlewares: [
  // ],
});
commented

use the middleware:

serve({
  plugins: [denoDeploy({ modules }), react({ ssr: true }), unocss(config)],
  middlewares: [
    (req, ctx) => {
        const url = new URL(req.url)
        if (url.pathbame === "/api/ql") return yoga(req)
        ctx.next()
    }
  ],
});