/nuber-server

Server for the Uber Clone Course on Nomad Academy. GraphQL, Typescript, NodeJS

Primary LanguageTypeScript

nuber-server

Server for the Uber Clone Course on Nomad Academy. GraphQL, Typescript, NodeJS

Install

Init

yarn add typescript ts-node nodemon --dev
yarn add tslint-config-prettier --dev
yarn add dotenv class-validator bcrypt

graphql

yarn add graphql-yoga graphql-tools merge-graphql-schemas

# install for connect to graphql and typescript
yarn add graphql-to-typescript gql-merge babel-runtime --dev

Middleware

yarn add helmet morgan cors

@types

yarn add @types/node @types/cors @types/helmet @types/morgan @types/bcrypt --dev

typeorm

yarn add typeorm pg

twilio

yarn add twilio
yarn add @types/twilio --dev

mailgun

yarn add mailgun-js && yarn add@types/mailgun-js --dev

jwt

yarn add jsonwebtoken
yarn add @types/jsonwebtoken --dev

for deploy

yarn global add now

Setup

Create database

Create strong password for JWT

Using Curry for resolverMiddleware

Resolvers

Public Resolvers

  • Sign In / Sign Up with Facebook
  • Sign In with Email
  • Start Phone Number Verification
  • Complete Phone Number Verification
  • Sign Up with Email

Authentication

  • Generate JWT
  • Verify JWT

Private Resolvers

  • Get My Profile
  • Request Email Verification
  • Complete Email Verification
  • Update My Profile
  • Toggle Driving Mode
  • Report Location / Orientation
  • Add Place
  • Edit Place
  • Delete Place
  • Get My Places
  • See Nearby Drivers
  • Subscribe to Nearby Drivers
  • Request a Ride
  • Get Nearby Ride Requests
  • Subscribe to Nearby Ride Requests
  • Update Ride Status
  • Get Ride
  • Subscribe to Ride Status
  • Create a Chat room
  • Get Chat Room Message
  • Send a Chat Message
  • Subscribe to Chat Room Messages

Code Challenge

  • Get Ride History
  • See Ride Detail

Memo

Typeorm makes relations fields automatically when only define fields name with Id

  • Need relations with User, just add Columns in Entity with userId
@Column({ nullable: true })
  userId: number;

Find Operator on typeorm

  • Find operators like between work only with getRepository function(These functions didn't work on active record)
  • Typeorm find options

SMS Setting

Setup Twilio(Programmable SMS)

  1. Make project
  2. Add credit card info
  3. Buy Amarican number
  4. Set Messaging Geographic Permissions

Using Token

  1. Go Dashboard
  2. Copy Auth Token
  3. Set environment variables in .env file
TWILIO_SID=
TWILIO_TOKEN=
TWILIO_PHONE=