{"id":20318144,"url":"https://github.com/deadcoder0904/jokes-server-error","last_synced_at":"2025-03-04T09:17:36.588Z","repository":{"id":41786115,"uuid":"213416311","full_name":"deadcoder0904/jokes-server-error","owner":"deadcoder0904","description":"Jokes App made using Prisma2 which throws weird error ☠️","archived":false,"fork":false,"pushed_at":"2022-12-11T08:31:39.000Z","size":471,"stargazers_count":1,"open_issues_count":9,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-14T13:18:11.887Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deadcoder0904.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-07T15:13:08.000Z","updated_at":"2020-06-02T13:58:49.000Z","dependencies_parsed_at":"2023-01-26T19:15:59.917Z","dependency_job_id":null,"html_url":"https://github.com/deadcoder0904/jokes-server-error","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadcoder0904%2Fjokes-server-error","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadcoder0904%2Fjokes-server-error/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadcoder0904%2Fjokes-server-error/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadcoder0904%2Fjokes-server-error/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deadcoder0904","download_url":"https://codeload.github.com/deadcoder0904/jokes-server-error/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241818899,"owners_count":20025212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T18:38:14.463Z","updated_at":"2025-03-04T09:17:36.570Z","avatar_url":"https://github.com/deadcoder0904.png","language":"JavaScript","readme":"# GraphQL Server Example\n\nThis example shows how to implement a **GraphQL server with JavaScript (Node.js)** based on [Photon.js](https://photonjs.prisma.io/) \u0026 [graphql-yoga](https://github.com/prisma/graphql-yoga).\n\n## How to use\n\n### 1. Download example \u0026 install dependencies\n\nClone the `prisma2` branch of this repository:\n\n```\ngit clone --single-branch --branch prisma2 git@github.com:prisma/prisma-examples.git\n```\n\nInstall Node dependencies:\n\n```\ncd prisma-examples/javascript/graphql\nnpm install\n```\n\n### 2. Install the Prisma 2 CLI\n\nTo run the example, you need the [Prisma 2 CLI](https://github.com/prisma/prisma2/blob/master/docs/prisma-2-cli.md):\n\n```\nnpm install -g prisma2\n```\n\n### 3. Set up database\n\nFor this example, you'll use a simple [SQLite database](https://www.sqlite.org/index.html). To set up your database, run:\n\n```\nprisma2 lift save --name 'init'\nprisma2 lift up\n```\n\nYou can now use the [SQLite Browser](https://sqlitebrowser.org/) to view and edit your data in the `./prisma/dev.db` file that was created when you ran `prisma2 lift up`.\n\n\u003cDetails\u003e\n\u003cSummary\u003e\u003cb\u003eAlternative: \u003c/b\u003eConnect to your own database\u003c/Summary\u003e\n\nPrisma supports MySQL and PostgreSQL at the moment. If you would like to connect to your own database, you can do so by specifying a different data source in the [Prisma schema file](prisma/schema.prisma).\n\nFor a MySQL provider:\n```\ndatasource mysql {\n    provider = \"mysql\"\n    url      = \"mysql://johndoe:secret42@localhost:3306/mydatabase\"\n}\n```\n\n*OR*\n\nFor a PostgreSQL provider:\n```\ndatasource postgresql {\n  provider = \"postgresql\"\n  url      = \"postgresql://johndoe:secret42@localhost:5432/mydatabase?schema=public\"\n}\n```\n\n\u003e Note: In the above example connection strings, `johndoe` would be the username to your database, `secret42` the password, `mydatabase` the name of your database, and `public` the [PostgreSQL schema](https://www.postgresql.org/docs/9.1/ddl-schemas.html). \n\nThen to migrate your database, run:\n\n```sh\nprisma2 lift save --name 'init'\nprisma2 lift up\n```\n\u003c/Details\u003e\n\n### 4. Generate Photon (type-safe database client)\n\nRun the following command to generate [Photon.js](https://photonjs.prisma.io/):\n\n```\nprisma2 generate\n```\n\nNow you can seed your database using the `seed` script from `package.json`:\n\n```\nnpm run seed\n```\n\n\n### 5. Start the GraphQL server\n\nLaunch your GraphQL server with this command:\n\n```\nnpm run start\n```\n\nNavigate to [http://localhost:4000](http://localhost:4000) in your browser to explore the API of your GraphQL server in a [GraphQL Playground](https://github.com/prisma/graphql-playground).\n\n### 6. Using the GraphQL API\n\nThe schema that specifies the API operations of your GraphQL server is defined in [`./src/schema.graphql`](./src/schema.graphql). Below are a number of operations that you can send to the API using the GraphQL Playground.\n\nFeel free to adjust any operation by adding or removing fields. The GraphQL Playground helps you with its auto-completion and query validation features.\n\n#### Retrieve all published posts and their authors\n\n```graphql\nquery {\n  feed {\n    id\n    title\n    content\n    published\n    author {\n      id\n      name\n      email\n    }\n  }\n}\n```\n\n\u003cDetails\u003e\u003cSummary\u003e\u003cstrong\u003eSee more API operations\u003c/strong\u003e\u003c/Summary\u003e\n\n#### Create a new user\n\n```graphql\nmutation {\n  signupUser(\n    data: {\n      name: \"Sarah\"\n      email: \"sarah@prisma.io\"\n    }\n  ) {\n    id\n  }\n}\n```\n\n#### Create a new draft\n\n```graphql\nmutation {\n  createDraft(\n    title: \"Join the Prisma Slack\"\n    content: \"https://slack.prisma.io\"\n    authorEmail: \"alice@prisma.io\"\n  ) {\n    id\n    published\n  }\n}\n```\n\n#### Publish an existing draft\n\n```graphql\nmutation {\n  publish(id: \"__POST_ID__\") {\n    id\n    published\n  }\n}\n```\n\n\u003e **Note**: You need to replace the `__POST_ID__`-placeholder with an actual `id` from a `Post` item. You can find one e.g. using the `filterPosts`-query.\n\n#### Search for posts with a specific title or content\n\n```graphql\n{\n  filterPosts(searchString: \"graphql\") {\n    id\n    title\n    content\n    published\n    author {\n      id\n      name\n      email\n    }\n  }\n}\n```\n\n#### Retrieve a single post\n\n```graphql\n{\n  post(id: \"__POST_ID__\") {\n    id\n    title\n    content\n    published\n    author {\n      id\n      name\n      email\n    }\n  }\n}\n```\n\n\u003e **Note**: You need to replace the `__POST_ID__`-placeholder with an actual `id` from a `Post` item. You can find one e.g. using the `filterPosts`-query.\n\n#### Delete a post\n\n```graphql\nmutation {\n  deleteOnePost(where: {id: \"__POST_ID__\"})\n  {\n    id\n  }\n}\n```\n\n\u003e **Note**: You need to replace the `__POST_ID__`-placeholder with an actual `id` from a `Post` item. You can find one e.g. using the `filterPosts`-query.\n\n\u003c/Details\u003e\n\n\n## Next steps\n\n- Read the [Prisma 2 announcement](https://www.prisma.io/blog/announcing-prisma-2-zq1s745db8i5/)\n- Check out the [Prisma 2 docs](https://github.com/prisma/prisma2)\n- Share your feedback in the [`prisma2-preview`](https://prisma.slack.com/messages/CKQTGR6T0/) channel on the Prisma Slack\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeadcoder0904%2Fjokes-server-error","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeadcoder0904%2Fjokes-server-error","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeadcoder0904%2Fjokes-server-error/lists"}