Sample Scripts
SampleAuth
Synopsis
SampleAuth.ps1
Description
Caching
Synopsis
A sample PowerShell script to set up a Pode server and integrate with Redis for caching.
Description
This script sets up a Pode server listening on port 8081 with Redis integration for caching.
It checks for the existence of the redis-cli
command and sets up a Pode server with routes
that demonstrate caching with Redis.
Create-Routes
Synopsis
A sample PowerShell script to set up a Pode server with multiple routes using different approaches.
Description
This script sets up a Pode server listening on port 8081 with various routes demonstrating different approaches to route creation. These include using script blocks, file paths, and direct script inclusion.
Dot-SourceScript
Synopsis
A sample PowerShell script to set up a Pode server and run a script from an external file.
Description
This script sets up a Pode server, enables terminal logging for errors, and uses an external script for additional logic. It imports the Pode module from the source path if available, otherwise from the installed modules.
External-Funcs
Synopsis
A sample PowerShell script to set up a Pode server and use an external module function.
Description
This script sets up a Pode server listening on port 8081, imports an external module containing functions, and includes a route that uses a function from the external module to generate a response.
File-Monitoring
Synopsis
A sample PowerShell script to set up a Pode server with a view engine and file monitoring.
Description
This script sets up a Pode server listening on port 8081, uses Pode's view engine for rendering web pages, and configures the server to monitor file changes and restart automatically.
File-Watchers
Synopsis
A sample PowerShell script to set up a Pode server with file watcher and logging.
Description
This script sets up a Pode server, enables terminal logging for errors, and adds a file watcher to monitor changes in PowerShell script files (*.ps1) within the script directory. The server logs file change events and outputs them to the terminal.
FileBrowser
Synopsis
PowerShell script to set up a Pode server with static file browsing and authentication.
Description
This script sets up a Pode server that listens on port 8081. It includes static file browsing with different routes, some of which require authentication. The script also demonstrates how to set up basic authentication using Pode.
The server includes routes for downloading files, browsing files without downloading, and accessing files with authentication.
HelloWorld
Synopsis
PowerShell script to set up a Pode server with a simple GET endpoint.
Description
This script sets up a Pode server that listens on port 8080. It includes a single route for GET requests to the root path ('/') that returns a simple text response.
IIS-Example
Synopsis
A sample PowerShell script to set up a Pode server with logging and task scheduling.
Description
This script sets up a Pode server listening on port 8081, enables terminal logging for requests and errors, and includes a scheduled task. The server has two routes: one for a simple JSON response and another to invoke a task that demonstrates delayed execution.
Logging
Synopsis
A sample PowerShell script to set up a Pode server with configurable logging, view engine, and various routes.
Description
This script sets up a Pode server listening on port 8081, configures a view engine, and allows for different types of request logging (terminal, file, custom). It includes routes for serving a web page, simulating a server error, and downloading a file.
Looping-Service
Synopsis
A sample PowerShell script to set up a Pode server with interval-based service handlers.
Description
This script sets up a Pode server that runs with a specified interval, adding service handlers that execute at each interval. The handlers include logging messages to the terminal and using lock mechanisms.
Mail-Server
Synopsis
A sample PowerShell script to set up a Pode server with SMTP and SMTPS protocols.
Description
This script sets up a Pode server listening on SMTP (port 25) and SMTPS (with explicit and implicit TLS). It includes logging for errors and debug information and demonstrates handling incoming SMTP emails with potential attachments.
Middleware
Synopsis
A sample PowerShell script to set up a Pode server with rate limiting and middleware.
Description
This script sets up a Pode server listening on port 8081 with various middleware implementations and rate limiting for incoming requests. It includes middleware for route-specific logic, blocking specific user agents, and rejecting requests from certain IP addresses.
OneOff-Script
Synopsis
A simple PowerShell script to set up a Pode server and log a message.
Description
This script sets up a Pode server, enables terminal logging for errors, and writes a "hello, world!" message to the terminal. The server runs the logic once and then exits.
OpenApi-SimplePotato
Synopsis
Sets up a Pode server with OpenAPI documentation, request logging, and routes for handling 'potato' requests.
Description
This script configures a Pode server to listen on a specified port, enables both request and error logging, and sets up OpenAPI documentation. It defines routes for fetching 'potato' data with responses in both JSON and plain text. OpenAPI documentation is exposed via Swagger and other viewers.
OpenApi-TuttiFrutti
Synopsis
A sample PowerShell script to set up a Pode server with OpenAPI 3.0 and 3.1 specifications.
Description
This script sets up a Pode server listening on ports 8081 and 8082 with OpenAPI 3.0 and 3.1 specifications. It includes multiple endpoints, OpenAPI documentation, various route definitions, authentication schemes, and middleware for enhanced API functionality.
Petstore-OpenApi
Synopsis
PowerShell script to set up a Pode server for a Pet Store API using OpenAPI 3.0 specifications.
Description
This script sets up a Pode server that listens on a specified port and uses OpenAPI 3.0 specifications for defining the API. It supports multiple endpoints for managing pets, orders, and users with various authentication methods including API key, Basic, and OAuth2.
This example shows how to use session persistent authentication using Windows Active Directory. The example used here is Form authentication, sent from the