Skip to content

Commit

Permalink
add: Powershell Profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Rene-Roscher committed Dec 7, 2022
1 parent 03dffa8 commit 5267e78
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,30 @@ To stop the load balancer, press CTRL+C in the terminal where it is running. Thi

```code
node load-balancer.js C:\Users\Rene\Desktop\laravel-application\artisan 8
```
```

# Example for Windows Powershell Profile
- Open Windows Powershell.
- Run the command: notepad $profile or code $profile
- Add the following code to the file:
```code
// Start the load balancer (SLB = Start Load Balancer)
function slb() {
node C:\Users\Rene\Desktop\test-projects\node-testing\load-balancer.js Get-FullPath\artisan $args
}
function Get-FullPath {
# Get the current directory
$currentDirectory = Get-Location
# Get the full path of the current directory
$fullPath = $currentDirectory.Path
# Return the full path
return $fullPath
}
```
- Go into your Laravel project directory.
- Open Windows Powershell.
- Run the command: slb [instances], where [instances] is the optional number of instances to run. The default value is 8.
- The load balancer will start and you can access the server application at http://localhost:5000.
6 changes: 5 additions & 1 deletion load-balancer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ const loadBalancer = {
},

killProcesses: () => {
processes.forEach(process => process.kill());
console.log('Killing processes...');
processes.forEach(process => {
console.log('Killing process: ' + process.pid);
process.kill();
});
},

};
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dependencies": {
"http-proxy": "^1.18.1",
"process": "^0.11.10",
"request": "^2.88.2"
"request": "^2.88.2",
"yargs": "^17.6.2"
}
}

0 comments on commit 5267e78

Please sign in to comment.