Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ariesclark/oily.js
A blazingly fast Bun.js filesystem router, with an unpleasantly smooth experience!
https://github.com/ariesclark/oily.js
bun filesystem http http-server router
Last synced: 29 days ago
JSON representation
A blazingly fast Bun.js filesystem router, with an unpleasantly smooth experience!
- Host: GitHub
- URL: https://github.com/ariesclark/oily.js
- Owner: ariesclark
- License: mit
- Created: 2022-07-28T11:55:02.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-31T04:28:17.000Z (over 2 years ago)
- Last Synced: 2024-10-02T15:30:51.066Z (about 1 month ago)
- Topics: bun, filesystem, http, http-server, router
- Language: TypeScript
- Homepage: https://npm.im/oily
- Size: 154 KB
- Stars: 37
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Oily
A blazingly fast Bun.js filesystem router, with an unpleasantly smooth experience!
Installation
·
Usage
·
Examples
·
Discord
## Installation
Once you've got [Bun.js](https://bun.sh/) installed, The installation is super simple, just run the following commands.
```bash
# 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
```ts
// 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.
```ts
// file: ./src/http/routes/foo.ts
import { Oily } from "oily";export default Oily.route({
methods: {
get: {
async handle() {
return Response.json({
foo: true
});
}
}
}
});
```