Git Product home page Git Product logo

typescript-apollo's Introduction

How to GraphQL ๐ŸŽ“

How to GraphQL is a fullstack tutorial website to learn all about GraphQL! It was built by Prisma and many amazing contributors. All content on the site is completely free and open-source.

Note: This repository is currently mostly unmaintained. We are looking for maintainers who can help cleaning up issues and PRs opened by the community. If you are interested in helping out, please reach out!

Content

The content for all tutorials is located in the /content directory. Here is an overview of all the tutorials that are available at the moment:

GraphQL

  • Fundamentals of GraphQL
  • Advanced GraphQL

Frontend

  • React & Apollo
  • React & Relay (Out of date)
  • Vue & Apollo (Out of date)
  • Ember & Apollo (Out of date)

Backend

  • javascript-apollo / JavaScript & Apollo
  • typescript-apollo / Typescript & Apollo
  • typescript-helix / Typescript & Helix
  • graphql-elixir / Absinthe & Elixir
  • graphql-ruby / Ruby and GraphQL Gem
  • graphql-python / Python & Graphene
  • graphql-go / Go & gqlgen
  • graphql-scala / Scala & Sangria
  • graphql-java / Java (Out of date)

Contributions / Fixes

As the whole project is open-source, you're more than welcome to fix typos and other small issues yourself and create a PR for the fix. If you want to contribute a whole tutorial track or update one of the out of date tutorials please get in touch.

Installation & Running locally

The project has some native (gyp) dependencies. To get this running, please make sure your environment it set with the following:

  1. Make sure to install a Node version manager (either fnm or nvm)
  2. Point your environment to the version specified in .nvmrc.
  3. Make sure to load .env to your environment variables (some shell loads it automatically, but if not, you can do: source .env to load it)

You can run a local instance of How to GraphQL by executing the following commands in a terminal:

git clone [email protected]:howtographql/howtographql.git
cd howtographql
yarn install
yarn start # http://localhost:8000/

Note: If you're using Node 8, you might need to invoke npm install -g node-gyp before you're starting the app. More info here.

Troubleshooting

If you are having issues with sharp dependency, please make sure you have installed >0.18.2 of it. Older versions have hardcoded dependency on a legacy artifactory.

To check the version you have, run: yarn why sharp.

If you are still having issues, please make sure that you have SHARP_DIST_BASE_URL environemnt variable set correctly (see .env file) and then run yarn install again.

typescript-apollo's People

Contributors

renovate-bot avatar renovate[bot] avatar ruheni avatar tasinishmam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

typescript-apollo's Issues

how do i access datasource object inside the resolver

Hi, Thank you for the awesome tutorial.
suppose if i have my index.ts file like this

import { ApolloServer } from 'apollo-server'
import { schema } from './schema'
import { context } from './context'

//configs
import appConfig from './appConfig/app'

import { SmsAPI } from './datasources/SMS/SmsAPI'

export const server = new ApolloServer({
  schema,
  dataSources: () => ({
    launchAPI: new SmsAPI(),
  }),
  context,
})

server.listen({ port: appConfig.port }).then(async ({ url }) => {
  console.log(`๐Ÿš€ Server ready at: ${url}${appConfig.graphqlPath}`)
})

and my context file like the following.

import { PrismaClient } from '@prisma/client'
import { decodeAuthHeader, AuthTokenPayload } from './utils/auth'
import { Request } from 'express'

export const prisma = new PrismaClient({
  log: ['query', 'error'],
})

export interface Context {
  prisma: PrismaClient
  userId?: number
}

export const context = ({ req }: { req: Request }): Context => {
  const token =
    req && req.headers.authorization
      ? decodeAuthHeader(req.headers.authorization)
      : null

  return {
    prisma,
    userId: token?.userId,
  }
}

some where in the code in my OTP Resolver function, how do i access dataSources

export const OTPMutations = extendType({
....
async resolve(_, args, { userId, prisma }: Context) {
//code
}
....
})

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm @types/express-graphql Unavailable

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency prettier to v3
  • chore(deps): update postgres docker tag to v16
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

docker-compose
docker-compose.yml
  • postgres 13.9
github-actions
.github/workflows/deployment.yml
  • actions/checkout v2
  • akhileshns/heroku-deploy v3.12.12
npm
package.json
  • @prisma/client ^3.5.0
  • apollo-server ^3.5.0
  • bcryptjs ~2.4.0
  • graphql ^15.7.2
  • graphql-scalars ^1.14.1
  • jsonwebtoken ~8.5.0
  • nexus ^1.1.0
  • @types/bcryptjs ~2.4.0
  • @types/express ^4.17.13
  • @types/express-graphql ^0.9.0
  • @types/jsonwebtoken ~8.5.0
  • prettier ^2.4.1
  • prisma ^3.5.0
  • ts-node-dev ^1.1.8
  • typescript ^4.3.5

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.