Git Product home page Git Product logo

gin-gorm's Introduction

Gin-Gorm API Template

This repository contains a RESTful API implementation using the Gin web framework, Gorm as the Object-Relational Mapping (ORM) library, and PostgreSQL as the underlying database.

The API serves as a foundation for building web applications and services with robust routing, database connectivity, and query management. It provides a structured architecture to handle HTTP requests, perform CRUD (Create, Read, Update, Delete) operations on the database, and return appropriate responses.

Getting started

Clone the repository

git clone https://github.com/Fabrizio-rar/Gin-Gorm.git

Set up your work environment

  • Ensure you have Go installed in your machine, for more information access https://go.dev/
  • Create your .env file using the provided example, add the desired port in which the application will run and the URI for the PostgreSQL database

Run the application

Run the run.sh script to start the application

API Reference

Create an user

  POST /create_user

Request body:

{
    "Name": "Name",
    "Gender": "Gender",
    "Email": "Email",
    "Password": "Password"
}

Creates a new user

Get all users

  GET /get_all_users

Returns all of the users stored in the database.

Get user

  GET /get_user/${email}
Parameter Type Description
email string Required. User email

Returns a user by its email

Delete user

  POST /delete_user
Parameter Type Description
email string Required. User email

Deletes a user and all its entries by its email

Create an entry

  POST /create_entry

Request body:

{
    "Email": "Email",
    "Title": "Title",
    "Content": "Content"
}

Creates an entry associated with a users email

Get an entry

  GET /[email protected]&title=ExampleTitle
Parameter Type Description
email string Required. User email
title string Required. Title of the entry

Returns the entry with the specific title from a user

Get all entries from a user

  GET /get_user_entries/${email}
Parameter Type Description
email string Required. User email

Returns all the entries from a user

Delete an entry

  POST /[email protected]&title=ExampleTitle
Parameter Type Description
email string Required. User email
title string Required. Title of the entry

Deletes an entry with the specific title from a user

Update an entry

  POST /update_entry

Request body:

{
    "Email": "Email",
    "Title": "Title",
    "Content": "Content"
}

Updates an entry's content from a specific user and title

gin-gorm's People

Contributors

fabrizio-rar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.