Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nikolasburk/blogr
https://github.com/nikolasburk/blogr
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nikolasburk/blogr
- Owner: nikolasburk
- Created: 2018-02-15T18:44:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-21T12:57:22.000Z (over 6 years ago)
- Last Synced: 2024-10-02T17:21:06.429Z (about 1 month ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 16
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Blogr - A simple blogging API
To learn more about this project, check out this [article](https://www.prisma.io/docs/tutorials/build-graphql-servers/development/build-a-graphql-server-from-scratch-nahgaghei6).
## Usage
### 1. Clone repository & deploy Prisma service
```sh
git clone [email protected]:nikolasburk/blogr.git
cd blogr
prisma deploy
```When prompted where (i.e. to which _Prisma server_) you want to deploy your service, select the **Demo server**. For all subsequent questions you can simply choose the suggested values by hitting **Enter**. (Note that 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__`:
```js
const server = new GraphQLServer({
typeDefs: './src/schema.graphql',
resolvers,
context: req => ({
...req,
db: new Prisma({
typeDefs: 'src/generated/prisma.graphql',
endpoint: '__PRISMA_ENDPOINT__',
}),
}),
})
```For example:
```js
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/jane-doe/database/dev',
}),
}),
})
```### 3. Start the server
Now, you can start the server:
```sh
node src/index.js
```For more info, see [here](https://www.prisma.io/docs/tutorials/build-graphql-servers/development/build-a-graphql-server-from-scratch-nahgaghei6).