@unicorn.web/core v0.0.0
📖 Table of Contents
📍 Overview
Unicorn-web is a bun based web framework which makes the process of creating a web application much simpler. It provides core HTTP entities to simplify and standardize the HTTP requests handling operations by offering a convenient way to setup a server, define routes and extract relevant information from the requests. It aims to be a fast, highly customizable and scalable web framework that helps you in your daily tasks, providing common functionality abstractions, improve code readability and maintainability.
🚀 Getting Started
🔧 Installation
bun add @unicorn.web/core🤖 Building your first unicorn.app
Let's create your first unicorn.app
- Open your
index.tsand creates a new server instance:
import { UnicornServer } from '@unicorn.web/core'
const server = new UnicornServer();- Add some routers to fetch requests:
import { UnicornServer } from 'unicorn.web'
const server = new UnicornServer();
server.get('foo', () => new Response('foo'));
server.post('boo', (ctx) => new Response(`Hi, ${ctx.body.name}`));- Serve the application in a port of your choice:
import { UnicornServer } from 'unicorn.web'
const server = new UnicornServer();
server.get('foo', () => new Response('foo'));
server.post('boo', (ctx) => new Response(`Hi, ${ctx.body.name}`));
server.serve(3000);- Start the server
bun run index.tsJust four lines and you have a working web application. Now, your app is running at http://localhost in the port you previously setup. If you make get requests for http://localhost:3000/foo it will receive foo back and if you make post requests for http://localhost:3000/boo you receive Hi and the name you sent in the body back.
🤝 Contributing
Contributions are always welcome! Please follow these steps:
Fork the project repository.
Create a new branch with a descriptive name (e.g.,
new-feature-branchorbugfix-issue-123).
git checkout -b new-feature-branch- Commit your changes with a clear commit message that explains the changes you've made.
git commit -m 'Implemented new feature.'- Push your changes to your forked repository
git push origin new-feature-branch- Create a new pull request describing the changes you've made and why they're necessary.
The project maintainers will review your changes and provide feedback or merge them into the main branch.
📄 License
This project is licensed under the MIT License. See the LICENSE file for additional info.
2 years ago