Skip to content

Commit c1dc77c

Browse files
author
mirkobrombin
committed
docs: list plugins details in README
also extended future plans
1 parent edf1bc7 commit c1dc77c

File tree

1 file changed

+95
-1
lines changed

1 file changed

+95
-1
lines changed

README.md

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ GoUP! is a minimal, tweakable web server written in Go. You can use it to serve
1616
## Future Plans
1717

1818
- API for dynamic configuration changes
19+
- Docker/Podman support for easy deployment
1920

2021
## Installation
2122

@@ -172,7 +173,8 @@ The following plugins are included:
172173

173174
- **Custom Header Plugin**: Adds custom headers to HTTP responses, configured per domain.
174175
- **PHP Plugin**: Handles `.php` requests using PHP-FPM.
175-
- **AuthPlugin**: Protects routes with basic authentication.
176+
- **Auth Plugin**: Protects routes with basic authentication.
177+
- **NodeJS Plugin**: Handles Node.js applications using `node`.
176178

177179
### Enabling Plugins
178180

@@ -199,11 +201,103 @@ the site's JSON configuration file. Example:
199201
"user": "userpass"
200202
},
201203
"session_expiration": 3600
204+
},
205+
"NodeJSPlugin": {
206+
"enable": true,
207+
"port": "3000",
208+
"root_dir": "/path/to/node/app",
209+
"entry": "server.js",
210+
"install_deps": true,
211+
"node_path": "/usr/bin/node",
212+
"package_manager": "pnpm",
213+
"proxy_paths": ["/api/", "/backend/"]
202214
}
203215
}
204216
}
205217
```
206218

219+
### Pre-Installed Plugins
220+
221+
#### Custom Header Plugin
222+
223+
Adds custom headers to HTTP responses. The configuration is a simple key-value pair:
224+
225+
```json
226+
{
227+
"X-Custom-Header": "Hello, World!"
228+
}
229+
```
230+
231+
at the site level, not in the `plugin_configs` section.
232+
233+
#### PHP Plugin
234+
235+
Handles `.php` requests using PHP-FPM. The configuration includes the path to the
236+
PHP-FPM socket:
237+
238+
```json
239+
{
240+
"enable": true,
241+
"fpm_addr": "/run/php/php8.2-fpm.sock"
242+
}
243+
```
244+
245+
can be both a socket path or an IP address with a port.
246+
247+
#### Auth Plugin
248+
249+
Protects routes with basic authentication. The configuration includes the protected
250+
paths, credentials, and session expiration time in seconds:
251+
252+
```json
253+
{
254+
"protected_paths": ["/protected.html"],
255+
"credentials": {
256+
"admin": "password123",
257+
"user": "userpass"
258+
},
259+
"session_expiration": 3600
260+
}
261+
```
262+
263+
session expiration is defined in seconds.
264+
265+
#### NodeJS Plugin
266+
267+
Handles Node.js applications using `node`. The configuration includes the port, root
268+
directory, entry file, and other settings:
269+
270+
```json
271+
{
272+
"enable": true,
273+
"port": "3000",
274+
"root_dir": "/path/to/node/app",
275+
"entry": "server.js",
276+
"install_deps": true,
277+
"node_path": "/usr/bin/node",
278+
"package_manager": "pnpm",
279+
"proxy_paths": ["/api/", "/backend/"]
280+
}
281+
```
282+
283+
- **port**: The port number to run the Node.js application on, be careful not
284+
to use the same port as the GoUP! server and other Node.js applications, GoUp
285+
will handle the routing but not the collision of ports.
286+
- **root_dir**: The path to the Node.js application directory.
287+
- **entry**: The entry file for the Node.js application (e.g., `server.js`).
288+
- **install_deps**: Set to `true` to install dependencies using the package
289+
manager specified, this will automatically create a `node_modules` directory
290+
following the `package.json` instructions.
291+
- **node_path**: The path to the `node` executable, leave empty to use the
292+
system default.
293+
- **package_manager**: The package manager to use for installing dependencies,
294+
can be `npm`, `yarn`, `pnpm`, or any other package manager that follows
295+
the same syntax as `npm`. Leaving it blank will default to `npm`.
296+
- **proxy_paths**: The list of paths to be served by the Node.js application,
297+
all other paths will be served by GoUP! as static files or reverse proxies.
298+
Note that the paths automatically include all the child paths, so `/api/`
299+
will match `/api/v1/` and `/api/v1/users/` as well.
300+
207301
### Developing Plugins
208302

209303
You can create your own plugins by implementing the `Plugin` interface. Here’s a

0 commit comments

Comments
 (0)