Skip to content

Commit

Permalink
Merge pull request #18 from Badgerati/develop
Browse files Browse the repository at this point in the history
v0.11.1
  • Loading branch information
Badgerati authored Jun 1, 2018
2 parents 0fcc214 + 87c3745 commit 773af9c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[![PowerShell](https://img.shields.io/powershellgallery/v/pode.svg?label=powershell&colorB=085298)](https://www.powershellgallery.com/packages/Pode)
[![PowerShell](https://img.shields.io/powershellgallery/dt/pode.svg?label=downloads&colorB=085298)](https://www.powershellgallery.com/packages/Pode)

[![Docker](https://img.shields.io/docker/stars/badgerati/pode.svg)](https://hub.docker.com/r/badgerati/pode/)
[![Docker](https://img.shields.io/docker/pulls/badgerati/pode.svg)](https://hub.docker.com/r/badgerati/pode/)

Pode is a PowerShell web framework that runs HTTP/TCP listeners on specific ports, allowing you to host [REST APIs](#rest-api), [Web Pages](#web-pages) and [SMTP/TCP](#smtp-server) servers. It also allows you to render dynamic files using [Pode](#pode-files) files, which is effectively embedded PowerShell, or other [Third-Party](#third-party-view-engines) template engines.
Expand Down Expand Up @@ -478,4 +479,8 @@ Pode comes with a few helper functions - mostly for writing responses and readin
* `Get-PodeTcpHandler`
* `Get-PodeTimer`
* `Write-ToResponse`
* `Write-ToResponseFromFile`
* `Write-ToResponseFromFile`
* `Test-IsUnix`
* `Test-IsPSCore`
* `status`
* `include`
10 changes: 10 additions & 0 deletions examples/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM badgerati/pode:latest

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY . .

EXPOSE 8085

CMD [ "pwsh", "-c", "./web-pages-docker.ps1" ]
25 changes: 25 additions & 0 deletions examples/web-pages-docker.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
if ((Get-Module -Name Pode | Measure-Object).Count -ne 0)
{
Remove-Module -Name Pode
}

Import-Module Pode

# create a server, and start listening on port 8085
Server -Port 8085 {

engine pode

# GET request for web page on "localhost:8085/"
route 'get' '/' {
param($session)
view 'simple' -Data @{ 'numbers' = @(1, 2, 3); }
}

# GET request throws fake "500" server error status code
route 'get' '/error' {
param($session)
status 500
}

}
6 changes: 5 additions & 1 deletion src/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
'Xml',
'Pode',
'Timer',
'Csv'
'Csv',
'Test-IsUnix',
'Test-IsPSCore',
'Status',
'Include'
)

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
Expand Down

0 comments on commit 773af9c

Please sign in to comment.