Skip to content

change port of graphiql? #1320

Discussion options

You must be logged in to vote

found the answer. it was on the last line on migration but definitely not obvious.

just had to add .use('/api', yoga) to make it work on the same port:

const yoga = createServer({
	schema,
	context: async ({ req }): Promise<GraphQLContext> => ({
		admin: req.session.admin,
		origin: getRequestOrigin(req),
		prisma,
	}),
	plugins: [useApolloServerErrors()],
})

const isAdminMiddleware = (req: NextIronRequest, res: NextApiResponse, next: NextHandler) => {
	if (req.session.admin) {
		req.admin = req.session.admin
	}
	return next()
}

export default handler().use(isAdminMiddleware).use('/api', yoga)

Replies: 4 comments 8 replies

Comment options

You must be logged in to vote
1 reply
@deadcoder0904
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@Urigo
Comment options

Urigo Jun 27, 2022
Collaborator

@deadcoder0904
Comment options

@deadcoder0904
Comment options

Answer selected by deadcoder0904
Comment options

You must be logged in to vote
4 replies
@Urigo
Comment options

Urigo Jul 27, 2022
Collaborator

@deadcoder0904
Comment options

@Urigo
Comment options

Urigo Aug 6, 2022
Collaborator

@deadcoder0904
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants