ariesclark / oily.js

A blazingly fast Bun.js filesystem router, with an unpleasantly smooth experience!

Home Page:https://npm.im/oily

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Oily

A blazingly fast Bun.js filesystem router, with
an unpleasantly smooth experience!

npm npm
GitHub issues GitHub commit activity

Installation   ·   Usage   ·   Examples   ·   Discord

Installation

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

# Install Bun.js, If you haven't yet.
curl https://bun.sh/install | bash

# Use Bun's package manager to install, or you
# can use any package manager that supports Bun.js.
bun add oily

Usage

// file: ./src/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 ./http/routes directory, next to the entrypoint.

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

export default Oily.route({
  methods: {
    get: {
      async handle() {
        return Response.json({
          foo: true
        });
      }
    }
  }
});

About

A blazingly fast Bun.js filesystem router, with an unpleasantly smooth experience!

https://npm.im/oily

License:MIT License


Languages

Language:TypeScript 99.2%Language:JavaScript 0.8%