Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skullzarmy/fibonacci-bun-example
This example project demonstrates how to build a simple API and a web page that fetches data from this API. The project is built using the Bun runtime, a fast and efficient JavaScript/TypeScript runtime designed for high-performance applications.
https://github.com/skullzarmy/fibonacci-bun-example
api bun fibonacci-sequence js
Last synced: 22 days ago
JSON representation
This example project demonstrates how to build a simple API and a web page that fetches data from this API. The project is built using the Bun runtime, a fast and efficient JavaScript/TypeScript runtime designed for high-performance applications.
- Host: GitHub
- URL: https://github.com/skullzarmy/fibonacci-bun-example
- Owner: skullzarmy
- License: gpl-3.0
- Created: 2023-09-21T06:03:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-02T21:26:03.000Z (about 1 year ago)
- Last Synced: 2024-10-23T22:53:17.857Z (2 months ago)
- Topics: api, bun, fibonacci-sequence, js
- Language: TypeScript
- Homepage:
- Size: 50.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fibonacci Sequence with Bun Runtime
[![Run Bun Tests](https://github.com/skullzarmy/fibonacci-bun-example/actions/workflows/bun-tests.yml/badge.svg)](https://github.com/skullzarmy/fibonacci-bun-example/actions/workflows/bun-tests.yml)
## Overview
This example project demonstrates how to build a simple Fibonacci API and a web page that fetches the Fibonacci sequence from this API. The project is built using the Bun runtime, a fast and efficient JavaScript/TypeScript runtime designed for high-performance applications.
### Revolutionary Simplicity
One of the standout features of this project is its zero-dependency architecture. There are no external dependencies or initialization steps required to run the entire project. This is made possible by the Bun runtime, which provides native support for server-side operations, file handling, and more, right out of the box.
## Features
- Fibonacci API built with TypeScript
- Web page that fetches and displays the Fibonacci sequence
- Server and client code optimized for performance and efficiency
- Utilizes Bun's native file handlers and server capabilities
- Zero external dependencies
- Integrated Bun tests via [GitHub Actions workflow](.github/workflows/bun-tests.yml)## Prerequisites
[Bun runtime](https://bun.sh/) installed on your machine
```bash
curl -fsSL https://bun.sh/install | bash
```## Getting Started
Clone the Repository
```bash
git clone https://github.com/skullzarmy/fibonacci-bun-example.git
cd fibonacci-bun-example
```## Run the Server
```bash
bun fib-server.ts
```Or if you feel like typing more:
```bash
bun run fib-server.ts
```This will start the server, and it should be listening for incoming HTTP requests.
## Access the Web Page
Once the server is running, you can navigate to http://localhost:3000 (or whatever port you've configured) in your web browser to see the Fibonacci sequence being printed on the page.
![Web page in action](./fib-example.webp)
## Watch Mode (Optional)
If you want to run your server in watch mode, so that it restarts automatically whenever you make changes to your code, you can use the --watch flag:
```bash
bun --watch fib-server.ts
```## Accompanying Blog Post
For a detailed explanation of this project, its architecture, and its features, check out the accompanying blog post on [So Cal Tech Lab](https://socaltechlab.com/): [Peeling Back the Layers: A Comprehensive Look at Bun, the New JavaScript Runtime](https://socaltechlab.com/posts/peeling-back-the-layers-a-comprehensive-look-at-bun-the-new-javascript-runtime/)
## Contribution
While the code is free to use and I'd be thrilled to hear if you find it useful for any projects or learning, please note that this is not a maintained project. Contributions, other than pointing out mistakes or issues, would likely not be integrated and could be a waste of effort.
## License
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). For more information, please see the [LICENSE](./LICENSE) file in the repository or consult the [official GPL-3.0 documentation](https://www.gnu.org/licenses/gpl-3.0.en.html).