This project uses the NestJS Framework to create a scalable user microservice. It works in conjunction with GraphQL as its query language and MS SQL for database management.
This project shows examples of the core components of NestJS, GraphQL, and Auth Guards using JWT.
Prerequisite: Installation of Node.js
Install Packages
npm install
Running application
npm start
After successfully building + running, navigate to open http://localhost:3000/graphql
This projects uses TypeORM as its ORM. As such, you'll need to add connection information so it knows how to connect to your database.
Create/Add this file to the root directory with any host, username, password, database, and port options needed for the project to connect to your database. It is common practice to add this to the gitignore and to not store sensitive information in the repo. The following is an example of a mssql version of an ormconfig:
{
"type": "mssql",
"host": "123.111.22.333",
"port": 8383,
"username": "sa",
"password": "password",
"database": "UserService",
"synchronize": true,
"logging": false,
"migrationsRun": true,
"entities": [
"dist/user/*.entity{.ts,.js}"
],
"migrations": [
"src/migration/**/*.ts"
],
"subscribers": [
"src/subscriber/**/*.ts"
]
}
This is used in the update:packages script to easily keep this projects dependencies up-to-date.
Suggestion: Most version in the package.json are set to asterisks '*' and should be set to a specific version of your choosing. Then wipe-dependencies.js can be removed.
