Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/otto-aa/solid-local-pod
https://github.com/otto-aa/solid-local-pod
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/otto-aa/solid-local-pod
- Owner: Otto-AA
- License: mit
- Created: 2019-11-02T15:01:50.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T11:48:12.000Z (almost 2 years ago)
- Last Synced: 2024-08-10T10:11:41.331Z (3 months ago)
- Language: JavaScript
- Size: 44.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Solid Local Pod
A nodejs library which can be used for running a solid pod over localhost.
## Install
```sh
npm install solid-local-pod
```## Usage Example
This setup will serve the contents from the `/home/user/test` folder at https://localhost:3000. (Due to the automatic ssl certificate generation, you will likely need to accept the security risks in your browser, before being able to use it)
```javascript
const httpsLocalhost = require("https-localhost")()
const LocalPod = require('solid-local-pod')
// Note: You could use solid-auth-cli or any other fetch which works in nodejs
const solidFileFetch = require('solid-local-pod/src/solidFileFetch')async function main() {
// Note: If no certs are provided, it will run on http://localhost:${port}, else https://localhost${port}
const certs = await httpsLocalhost.getCerts()const pod = new LocalPod({
port: 3000,
basePath: '/home/user/test',
certs,
fetch: solidFileFetch
})pod.startListening()
}
main()
```You can also take a look at [solid-local-pod-manager](https://github.com/Otto-AA/solid-local-pod-manager) which uses this library.
## Configuration
| Param | Type | Description |
| ------------- |:-------------:|:-----|
| fetch | (url, options) => Response | Similar to window.fetch. (e.g. solid-auth-cli or solid-local-pod/src/solidFileFetch) |
| port | number | A free port |
| basePath | string | This will be the root of the solid pod |
| prefix | [string] | (Optional) Will be prepend to the request path |
| certs | [?] | (Optional) Certificates used for https## Methods
| Name | Description |
|:------------- |:-----|
| startListening | Starts the localhost server |
| stopListening | Stops the localhost server |
| isListening | Returns true if server is active |