Welcome to your new Bun project! This project is a REST API using Bun + Hono + MongoDB + TypeScript providing a powerful and efficient platform with a simple CRUD interface for a user model.
Before you begin, make sure you have the following installed:
- Clone this repository to your local machine
git clone https://github.com/ProMehedi/bun-hono-rest-api.git
- Navigate to the project directory
cd bun-hono-rest-api
- Install dependencies
bun install
To run:
bun run dev
Create a .env file in the root directory of your project. Add environment-specific variables on new lines in the form of NAME=VALUE. For example:
PORT=9000
MONGO_URI=mongodb://localhost:27017/bun-hono-rest-api
JWT_SECRET=secret
POST /api/v1/users (Create User)
POST /api/v1/users/login (Login User)
GET /api/v1/users/profile (Get User Profile)
GET /api/v1/useres (Get All Users)
GET /api/v1/users/:id (Get User By Id)
POST /api/v1/users (Create User)
{
"name": "Mehedi Hasan",
"email": "[email protected]",
"password": "123456"
}
POST /api/v1/users/login (Login User)
{
"email": "[email protected]",
"password": "123456"
}
GET /api/v1/users/profile (Get User Profile)
Authorisation Header (Bearer Token)
GET /api/v1/useres (Get All Users)
Authorisation Header (Bearer Token)
GET /api/v1/users/:id (Get User By Id)
Authorisation Header (Bearer Token)
├── .vscode
│ ├── settings.json
├── config
│ ├── db.ts
├── controllers
│ ├── user.ts
├── middlewares
│ ├── authMiddlewares.ts
│ ├── errorMiddlewares.ts
├── models
│ ├── userModels.ts
├── routes
│ ├── userRoutes.ts
├── utils
│ ├── getToken.ts
├── server.ts
├── .env
├── .gitignore
├── bun.lockb
├── README.md
├── package.json
├── tsconfig.ts
We welcome contributions to improve the API! If you find a bug, have a feature request, or want to suggest improvements, please create an issue in the GitHub repository. If you'd like to contribute code, feel free to fork the repository, create a new branch, commit your changes, and open a pull request.
Please ensure that your code follows the existing coding style and conventions.
This project is licensed under the [MIT] License
If you have any questions or need further assistance, you can reach us at Mehedi Hasan.