The code in this repo is fully functioning authentication API using graphql apollo, type-graphql, typegoose, nodejs, typescript, javascript, jwt tokens, express and mongodb.
To start this project, first clone the code using git:
git clone https://github.com/efenstakes/authentication-api-type-graphql api
Navigate to the project directory:
cd api
Install dependencies:
yarn install
Create .env in the src/ directory with below keys:
touch src/.env
DB_URL= PORT= ACCESS_TOKEN_SECRET= REFRESH_TOKEN_SECRET=
To start the API run:
yarn dev
To build the API run:
yarn build
To deploy the API to AWS Lambda, ensure you install serverless and run:
yarn build && serverless deploy
Build the Docker image:
docker build -t auth-api .
Start the Docker container:
docker run -p 8080:8080 auth-api
Typegoose can easily be replaced by an SQL ORM like TypeORM and this API will work perfectly with MySQL, Postgres or any other MYSQL database.
Contact me through. efenstakes101@gmail.com