Skip to content

GbrLomenha/node.js-fastfy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js Fastify API

A simple and efficient REST API built with Node.js and Fastify framework, demonstrating basic CRUD operations and database integration.

🚀 Features

  • Fast and low overhead web framework using Fastify
  • CRUD operations for managing resources
  • SQLite database integration
  • Request validation using JSON Schema
  • Environment configuration support

📋 Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn package manager

🛠️ Installation

  1. Clone the repository:
git clone https://github.com/GbrLomenha/node.js-fastfy.git
  1. Navigate to the project directory:
cd node.js-fastfy
  1. Install dependencies:
npm install

⚙️ Configuration

Create a .env file in the root directory and add your configuration:

PORT=3000
HOST=localhost

🏃‍♂️ Running the Application

Development mode

npm run dev

Production mode

npm start

🔄 API Endpoints

Users

  • GET /users - Get all users
  • GET /users/:id - Get a specific user by ID
  • POST /users - Create a new user
  • PUT /users/:id - Update a user
  • DELETE /users/:id - Delete a user

Request & Response Examples

GET /users

Response:

[
  {
    "id": 1,
    "name": "John Doe",
    "email": "[email protected]"
  },
  {
    "id": 2,
    "name": "Jane Doe",
    "email": "[email protected]"
  }
]

POST /users

Request:

{
  "name": "New User",
  "email": "[email protected]"
}

Response:

{
  "id": 3,
  "name": "New User",
  "email": "[email protected]"
}

🛠️ Built With

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

👤 Author

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

✨ Acknowledgments

  • Fastify documentation and community
  • Node.js community

⌨️ with ❤️ by Gabriel Lomenha

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published