Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HRIS-361 [Task] Setup Nest.js under api_v2 folder #297

Merged
merged 8 commits into from
Jun 11, 2024

Conversation

mdv-sunasterisk
Copy link
Contributor

@mdv-sunasterisk mdv-sunasterisk commented Jun 10, 2024

Issue Link

Backlog Link

Definition of Done

  • Setup Nest.js
  • Connect to graph QL
  • Setup Jest
  • Setup Husky pre-commit

Notes

  • Initial commit for the NestJS setup. Includes the necessary configuration to commence the slack API integration.

Pre-condition

  • Run the usual docker commands to update the project. The docker-compose.yml, dockerfile, .dockerignore files have been created/updated accordingly for a seamless update.

Expected Output

  • The NestJS project should be running on port 3001.

Screenshots/Recordings

Note: Minimal pre-commit alterations were added after the time of recording.

Screen.Recording.2024-06-07.at.1.11.27.PM.mov

@mdv-sunasterisk mdv-sunasterisk self-assigned this Jun 10, 2024
Comment on lines 12 to 13
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its good to have short command when running dev environment

Suggested change
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"dev": "nest start --watch",
"dev:debug": "nest start --debug --watch",

Comment on lines 15 to 16
"strictNullChecks": false,
"noImplicitAny": false,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much better if we follow strict implementation

Suggested change
"strictNullChecks": false,
"noImplicitAny": false,
"strictNullChecks": true,
"noImplicitAny": true,

@@ -0,0 +1,21 @@
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. can we add ?
    "noUnusedLocals": true,
    "noUnusedParameters": true,
  1. much better to also have alias
    "paths": { "@/*": ["src/*"] }

Comment on lines 20 to 21
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}
}
"exclude": ["node_modules", "dist"]
}

@mdv-sunasterisk mdv-sunasterisk requested a review from chevyB June 11, 2024 01:54
"dev": "nest start --watch",
"dev:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i want to include npm run lint without fix in husky pre-commit.
So dev can know that there are lint errors to fix and can be familiarize about linting.

Suggested change
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",

@@ -19,6 +19,21 @@ services:
depends_on:
- db

# ASP.NET Service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# ASP.NET Service
# NestJS Service

@@ -19,6 +19,21 @@ services:
depends_on:
- db

# ASP.NET Service
api_v2:
Copy link

@chevyB chevyB Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im just wondering what's the consideration why we containerized the api.
Its good that we have 1 command to run all servers but im worry if our laptops can handle many docker containers.
Is there is no difference about laptop performance running between npm run dev or using docker?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree that it feels heavy whenever i try running the docker compose command. Thought there was a deployment benefit to this as to why the previous team implemented this.

Personally, I run the docker compose command to run all of servers apart from api_v2, which i run locally using npm run dev.

May i ask for your thoughts? @chevyB

Copy link

@chevyB chevyB Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, its ok to retain the docker configs but when running local, its beneficial to use npm run dev.
Let's update readme.md about using npm run dev in local.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, will apply changes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdv-sunasterisk @chevyB
Just additional note though, the purpose of containers or even for VM, is to create a separate environment that will not tamper the host machine. But I do agree that somehow docker does not have a good review in terms of performance in local environment.

I can agree to just run node in the host machine instead of docker. Docker will be more responsible on infra stuffs like DB.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this container nalang

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah wait, please keep this lang. I will be considering to deploy backend with docker. Sorry.

Copy link
Contributor Author

@mdv-sunasterisk mdv-sunasterisk Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok copy, we'll be retaining the api_v2 container. Kindly requesting for next actions @jeremiahC, and may I confirm if we're already good for merging?

@mdv-sunasterisk mdv-sunasterisk requested a review from chevyB June 11, 2024 02:33
@mdv-sunasterisk mdv-sunasterisk merged commit 1f09f8b into develop Jun 11, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants