JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q39889F
  • License MIT

An unpleasantly smooth experience!

Package Exports

  • oily
  • oily/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (oily) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Oily

An unpleasantly smooth experience!

npm npm GitHub issues GitHub commit activity

Installation   ·   Usage   ·   Discord

Installation

Assuming you've got Bun.js installed, The installation is super simple, just run the following command.

bun add oily

Usage

// file: ./index.ts
import { Oily } from "oily";

await Oily.serve({
  middleware: [
    async (request, next) => {
      // do something before.
      const response = await next();
      // do something after.

      return response;
    }
  ]
});

// now listening on port 3000.

Routes are found, by default, within the ./routes directory, next to the entrypoint.

// file: ./routes/foo.ts
import { Oily } from "oily";

export default Oily.route({
  methods: {
    get: {
      async handle() {
        return Response.json({
          foo: true
        });
      }
    }
  }
});
curl http://localhost:3000/foo
# { "foo": true }
// file: ./routes/~bar/baz.ts
// this is a dynamic route.
import { Oily } from "oily";

export default Oily.route({
  methods: {
    get: {
      async handle({ query }) {
        return Response.json({
          baz: query.get("bar")
        });
      }
    }
  }
});
curl http://localhost:3000/hello/baz
# { "baz": "hello" }