Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric committed Apr 29, 2023
1 parent ae04c21 commit e69933f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions pages/api/hello.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import { Midjourney } from "midjourney";
import type { NextApiRequest, NextApiResponse } from "next";
import { ResponseError } from "../../interfaces";
import { Readable } from "stream";
const client = new Midjourney(
<string>process.env.SERVER_ID,
<string>process.env.CHANNEL_ID,
<string>process.env.SALAI_TOKEN
);
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
const { prompt } = req.body;
const stream = new Readable({
read() {
this.push("hello");
setTimeout(() => {
this.push("world");
this.push(null);
}, 1000);
},
});
stream.pipe(res);
}
2 changes: 1 addition & 1 deletion public/antd.min.css

Large diffs are not rendered by default.

1 comment on commit e69933f

@vercel
Copy link

@vercel vercel bot commented on e69933f Apr 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.