Skip to content

Graph-QL/blogr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blogr - A simple bloggin API

To learn more about this project, check out this article.

Usage

1. Clone repository & deploy Prisma service

git clone [email protected]:nikolasburk/blogr.git
cd blogr
prisma deploy

When prompted where (i.e. to which cluster) you want to deploy your service, choose any of the development clusters, e.g. public-us1 or public-eu1. (If you have Docker installed, you can also deploy locally.)

2. Set Prisma endpoint

From the output of the previous command, copy the HTTP endpoint and paste it into src/index.js where it's used to instantiate the Prisma binding. You need to replace the current placeholder __PRISMA_ENDPOINT__:

const server = new GraphQLServer({
  typeDefs: './src/schema.graphql',
  resolvers,
  context: req => ({
    ...req,
    db: new Prisma({
      typeDefs: 'src/generated/prisma.graphql',
      endpoint: '__PRISMA_ENDPOINT__',
      secret: 'mysecret123',
    }),
  }),
})

For example:

const server = new GraphQLServer({
  typeDefs: './src/schema.graphql',
  resolvers,
  context: req => ({
    ...req,
    db: new Prisma({
      typeDefs: 'src/generated/prisma.graphql',
      endpoint: 'https://eu1.prisma.sh/public-hillcloak-flier-942261/hackernews-graphql-js/dev',
      secret: 'mysecret123',
    }),
  }),
})

3. Start the server

Now, you can start the server:

node src/index.js

For more info, see here.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%