Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nextjs-prisma-graphql-todolist
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
challenges
nextjs-prisma-graphql-todolist
Commits
5a98e94d
Commit
5a98e94d
authored
3 years ago
by
Marco Wettstein
Browse files
Options
Downloads
Patches
Plain Diff
fix: stuff
parent
2e21f6a2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/graphql/schema.ts
+1
-1
1 addition, 1 deletion
src/graphql/schema.ts
src/graphql/server.ts
+4
-0
4 additions, 0 deletions
src/graphql/server.ts
src/pages/api/graphql.ts
+2
-6
2 additions, 6 deletions
src/pages/api/graphql.ts
with
7 additions
and
7 deletions
src/graphql/schema.ts
+
1
−
1
View file @
5a98e94d
import
{
makeSchema
,
queryType
}
from
"
nexus
"
;
import
{
makeSchema
,
queryType
}
from
"
nexus
"
;
import
{
nexusPrisma
}
from
"
nexus-plugin-prisma
"
;
import
{
nexusPrisma
}
from
"
nexus-plugin-prisma
"
;
import
prismaClient
from
"
../../prisma/prismaClient
"
;
import
*
as
userTypes
from
"
./types/User
"
;
import
*
as
userTypes
from
"
./types/User
"
;
import
{
join
}
from
"
path
"
;
import
{
join
}
from
"
path
"
;
export
const
schema
=
makeSchema
({
export
const
schema
=
makeSchema
({
...
...
This diff is collapsed.
Click to expand it.
src/graphql/server.ts
+
4
−
0
View file @
5a98e94d
import
{
ApolloServer
}
from
"
apollo-server-micro
"
;
import
{
ApolloServer
}
from
"
apollo-server-micro
"
;
import
{
context
}
from
"
./context
"
;
import
{
context
}
from
"
./context
"
;
import
{
schema
}
from
"
./schema
"
;
import
{
schema
}
from
"
./schema
"
;
const
{
ApolloServerPluginLandingPageGraphQLPlayground
,
}
=
require
(
"
apollo-server-core
"
);
export
const
server
=
new
ApolloServer
({
export
const
server
=
new
ApolloServer
({
schema
,
schema
,
context
,
context
,
plugins
:
[
ApolloServerPluginLandingPageGraphQLPlayground
()],
});
});
This diff is collapsed.
Click to expand it.
src/pages/api/graphql.ts
+
2
−
6
View file @
5a98e94d
...
@@ -5,16 +5,12 @@ const allowCors = (fn: any) => async (req: any, res: any) => {
...
@@ -5,16 +5,12 @@ const allowCors = (fn: any) => async (req: any, res: any) => {
"
Access-Control-Allow-Origin
"
,
"
Access-Control-Allow-Origin
"
,
"
https://studio.apollographql.com
"
"
https://studio.apollographql.com
"
);
);
// another common pattern
// res.setHeader('Access-Control-Allow-Origin', req.headers.origin);
res
.
setHeader
(
res
.
setHeader
(
"
Access-Control-Allow-Methods
"
,
"
Access-Control-Allow-Methods
"
,
"
GET,OPTIONS,PATCH,DELETE,POST,PUT
"
"
GET,OPTIONS,PATCH,DELETE,POST,PUT
"
);
);
res
.
setHeader
(
res
.
setHeader
(
"
Access-Control-Allow-Headers
"
,
"
*
"
);
"
Access-Control-Allow-Headers
"
,
"
X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version
"
);
if
(
req
.
method
===
"
OPTIONS
"
)
{
if
(
req
.
method
===
"
OPTIONS
"
)
{
res
.
status
(
200
).
end
();
res
.
status
(
200
).
end
();
return
;
return
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment