HUB
Sign inSign up

timesink/demo-api

By timesink

•Updated about 6 years ago

a simple api server written in typescript with express, graphql and prisma

Image
0

374

timesink/demo-api repository overview

⁠GraphQL-JWT-Server-Demo

A small demo project, based upon the video tutorial by "Stack That Code" on YouTube:

GraphQL, Express & Typescript

You can find my implementation of the client side of things in my other repository⁠.

⁠Used (Main-)technologies

⁠Additional used packages/technologies

Divergent from the video series, a few more/different technologies were added:

⁠How to use/install

⁠Docker
  • Install postgres ideally also via docker⁠
  • Set up a database (name it what you want, but of course it has to be in the connection string variable)
  • Create an .env-file (key=value) for the demo application with the values stated below
  • Spin up a container from the image with the --env-file parameter pointing to the aforementioned .env-file
  • Run yarn run prisma:migrate:up && node ./prisma/index.js to initialize the database and apply the migrations
  • Run docker run --env-file <path-to-env-file> -p <host-port>:<container-port> timesink/demo-api:<tag-you-want>
  • The project should now be listening on port you set
⁠From the project
  • Set up a postgres database
  • Set up a database (name it what you want, but of course it has to be in the connection string variable)
  • Create an .env-file (key=value) for the demo application with the values stated below in the base directory of the project
  • Run yarn run initDB to initialize the database and apply the migrations
  • Run yarn run dev
  • The project should now be listening on the port you set up in the env-file

⁠Available enviroment variables

Click to expand!
  • APP_PORT=
  • GRAPHQL_PATH=
  • DATABASE_URL=
  • ACCESS_TYPE_USER=user
  • ACCESS_TYPE_REFRESH=refresh
  • ACCESS_TYPE_CONFIRM=confirm
  • ACCESS_TYPE_FORGOT_PASSWORD=forgotPassword
  • REFRESH_TOKEN_EXPIRATION_DAYS=
  • REFRESH_TOKEN_SECRET=
  • ACCESS_TOKEN_EXPIRATION_MINUTES=
  • ACCESS_TOKEN_SECRET=
  • JWT_ISSUER=
  • REFRESH_TOKEN_NAME=
  • REFRESH_TOKEN_DOMAIN=
  • REFRESH_TOKEN_HTTPONLY=
  • REFRESH_TOKEN_SECURE=
  • CONFIRMATION_URL=
  • FORGOT_PASSWORD_URL=
  • CORS_ORIGIN=
  • SENDGRID_API_KEY=
  • SENDGRID_FROM_EMAIL=
  • SENDGRID_CONFIRMATION_TEMPLATE_ID=
  • SENDGRID_FORGOT_PASSWORD_TEMPLATE_ID=

Tag summary

Content type

Image

Digest

Size

138.8 MB

Last updated

about 6 years ago

docker pull timesink/demo-api