0.2.1 • Published 5 years ago

solid-local-pod v0.2.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Solid Local Pod

A nodejs library which can be used for running a solid pod over localhost.

Install

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)

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 which uses this library.

Configuration

ParamTypeDescription
fetch(url, options) => ResponseSimilar to window.fetch. (e.g. solid-auth-cli or solid-local-pod/src/solidFileFetch)
portnumberA free port
basePathstringThis will be the root of the solid pod
prefixstring(Optional) Will be prepend to the request path
certs?(Optional) Certificates used for https

Methods

NameDescription
startListeningStarts the localhost server
stopListeningStops the localhost server
isListeningReturns true if server is active
0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago