Skip to content

dfinke/PowerShellMicroservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PowerShell Microservice

A PowerShell REST API running as a microservice in a Docker container.

Plus, use PowerShell's Invoke-Build as continuous build to stop the container, rebuild the image, and then run the new container. Ready for testing.

Direct from GitHub

Build and run Docker the container straight from the repo.

docker build --tag powershellmicroservice https://github.com/dfinke/PowerShellMicroservice.git
docker run -d --name powershellmicroservice -p 8080:8080 powershellmicroservice

sleep 2 # give the container a chance to spin up

Invoke-RestMethod http://localhost:8080/ # Hello from PowerShell in Docker

How to Build and Run Locally

Install-Module InvokeBuild

Invoke-Build

Try it

Invoke-RestMethod http://localhost:8080/

Prints

hello world

Echo endpoint

Invoke-RestMethod http://localhost:8080/echo/YourData

Prints

[06/25/2020 21:13:58] echo: YourData

Update the PowerShell Script

  • Edit StartPodeServer.ps1
  • Comment out Write-PodeTextResponse -Value 'hello world'
  • Uncomment Write-PodeTextResponse -Value 'hello world, from PowerShell in Docker'
  • Save the file

Run

Invoke-Build

Try it:

Invoke-RestMethod http://localhost:8080/

Prints

hello world, from PowerShell in Docker

About

A PowerShell REST API running as a microservice in a Docker container.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published