-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.ps1
31 lines (23 loc) · 1011 Bytes
/
server.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Enter PSScriptRoot
cd $PSScriptRoot
Start-PodeServer -Threads 4 -RootPath "$PWD" {
Add-PodeEndpoint -Address * -Port 8080 -Protocol Http
New-PodeLoggingMethod -Terminal | Enable-PodeErrorLogging -Levels @("Error", "Warning")
Add-PodeRoute -Method Get -Path '/call' -ScriptBlock {
& "$PSScriptRoot\add2queueCALL.ps1" -number $WebEvent.Query['number']
}
Add-PodeRoute -Method Get -Path '/sms' -ScriptBlock {
$parameters = $WebEvent.Query
Write-Output $parameters
$result = (& "$PSScriptRoot\add2queueSMS.ps1" @parameters)
}
Add-PodeSchedule -Name 'startup-remove-lock' -Cron '*/1 * * * *' -Limit 1 -ScriptBlock {
pwsh -Command "Remove-Item `"$using:PWD\Instance.Lock`" -Force"
}
Add-PodeSchedule -Name 'mail-check' -Cron '*/1 * * * *' -ScriptBlock {
pwsh -File "$using:PWD/mail-check.ps1"
}
Add-PodeSchedule -Name 'task' -Cron '*/1 * * * *' -ScriptBlock {
pwsh -File "$using:PWD/task.ps1"
}
}