Skip to content

Serverless web application framework for Cloudflare Workers

License

Notifications You must be signed in to change notification settings

za-creature/bliss

Repository files navigation

npm tests coverage

bliss

Experimental work-in-progress some-batteries-included on('fetch') HTTP server framework designed and optimized for Cloudflare Workers

Originally written as a tech demo in 2018 back when CF workers was still in beta and there was no official tooling available. Nowadays you might at least consider using wrangler instead of the not-well-tested-but-mostly-works-for-me-on-mac CLI bundled with bliss.

Installation

npm i --save bliss-router

Usage

bliss uses a config file, usually bliss.config.js in the current working directory in order to describe the code and data segments of your application. The syntax is:

bliss.config.js

let {text, secret} = require("bliss-router/assets")
module.exports = {
    // this _should_ be a local file path instead but no judgement :)
    "code": "addEventListener('fetch', ev => ev.respondWith(new Response('hello world')))",
    "bindings": {
        "AWS_ACCESS_KEY_ID": {
            "type": "plain_text",
            "text": "AKIAIOSFODNN7EXAMPLE"
        },
        // you can also use the helper functions from `bliss-router/bindings` to generate these objects
        "AWS_SECRET_ACCESS_KEY": secret("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
        "AWS_REGION": text("us-east-1")
    }
}

With your config file correctly configured, you can then deploy your worker locally (by default on port 8080):

cd /path/to/your/folder/containing/bliss.config.js
npx bliss-router

For more options, see the CLI spec or run

npx bliss-router --help

Module docs

About

Serverless web application framework for Cloudflare Workers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published