Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eun/http-server-action
An action that spawns an http server to serve files.
https://github.com/eun/http-server-action
actions github-actions hacktoberfest
Last synced: 19 days ago
JSON representation
An action that spawns an http server to serve files.
- Host: GitHub
- URL: https://github.com/eun/http-server-action
- Owner: Eun
- License: mit
- Created: 2021-07-22T10:44:14.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-07T04:10:24.000Z (about 1 month ago)
- Last Synced: 2024-10-26T12:35:46.731Z (20 days ago)
- Topics: actions, github-actions, hacktoberfest
- Language: JavaScript
- Homepage:
- Size: 297 KB
- Stars: 12
- Watchers: 2
- Forks: 11
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# http-server-action
---
An action that spawns an http server to serve files.## Inputs
### `directory`
Path that should be served (default is `.`) (*optional*)### `port`
Port that should be used (default is `8080`) (*optional*)### `no-cache`
No-Cache determiantes wheter the server sets the Cache-Control header or not (default is `false`) (*optional*)### `index-files`
If set and directory is requested, look for those files, instead of show directory listing (default is EMPTY, sample is `["index.html", "index.htm"]`) (*optional*)### `allowed-methods`
Throw HTTP-Error 405 on other methods than the methods given (default is `["GET", "HEAD"]`) (*optional*)### `content-types`
A JSON object of content-types that should be served (*optional*)
Default:
```json
{
"appcache": "text/cache-manifest",
"css": "text/css",
"gif": "image/gif",
"html": "text/html",
"ico": "image/x-icon",
"jpeg": "image/jpeg",
"jpg": "image/jpeg",
"js": "text/javascript",
"json": "application/json",
"png": "image/png",
"txt": "text/plain",
"xml": "text/xml"
}
```
### `log`
Create a log file with the given name (default is ``, which means no logging) (*optional*)### `logTime`
Include the time of access in the log file (default is `true`) (*optional*)## Example
```yaml
steps:
-
name: Checkout code
uses: actions/checkout@v4
-
name: Serve Files
uses: Eun/http-server-action@v1
with:
directory: ${{ github.workspace }}
port: 8080
no-cache: false
index-files: |
["index.html", "index.htm"]
allowed-methods: |
["GET", "HEAD"]
content-types: |
{
"appcache": "text/cache-manifest",
"css": "text/css",
"gif": "image/gif",
"html": "text/html",
"ico": "image/x-icon",
"jpeg": "image/jpeg",
"jpg": "image/jpeg",
"js": "text/javascript",
"json": "application/json",
"png": "image/png",
"txt": "text/plain",
"xml": "text/xml"
}
log: "log.txt"
logTime: "false"
-
run: |
curl -vvvv http://localhost:8080/index.html
cat log.txt
```