A simple and efficient REST API built with Node.js and Fastify framework, demonstrating basic CRUD operations and database integration.
- Fast and low overhead web framework using Fastify
- CRUD operations for managing resources
- SQLite database integration
- Request validation using JSON Schema
- Environment configuration support
- Node.js (v14 or higher)
- npm or yarn package manager
- Clone the repository:
git clone https://github.com/GbrLomenha/node.js-fastfy.git
- Navigate to the project directory:
cd node.js-fastfy
- Install dependencies:
npm install
Create a .env
file in the root directory and add your configuration:
PORT=3000
HOST=localhost
npm run dev
npm start
GET /users
- Get all usersGET /users/:id
- Get a specific user by IDPOST /users
- Create a new userPUT /users/:id
- Update a userDELETE /users/:id
- Delete a user
Response:
[
{
"id": 1,
"name": "John Doe",
"email": "[email protected]"
},
{
"id": 2,
"name": "Jane Doe",
"email": "[email protected]"
}
]
Request:
{
"name": "New User",
"email": "[email protected]"
}
Response:
{
"id": 3,
"name": "New User",
"email": "[email protected]"
}
This project is licensed under the MIT License - see the LICENSE file for details.
- Gabriel Lomenha
- GitHub: @GbrLomenha
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Fastify documentation and community
- Node.js community
⌨️ with ❤️ by Gabriel Lomenha