Coder Social home page Coder Social logo

cakestore's Introduction

Cake Store RestAPI

dev with go to save cake data

How To Run

  1. To run this project, make sure you have install docker. then you can run command below
  docker run --name maria-cakestore -e MARIADB_ROOT_PASSWORD=root -e MARIADB_DATABASE=cake_store -p 3306:3306 -d mariadb/server:10.3
  1. After that on console db , create table with SQL below
    create table if not exists cake(
        id int auto_increment primary key ,
        title varchar(255) not null ,
        description text ,
        rating int ,
        image text,
        is_active boolean default 1,
        created_at timestamp default now(),
        updated_at timestamp default now()
    );
  1. clone and open project and run
  go run main.go
  1. and run in postman with port 9000 ex :
  localhost:9000

API Reference

Get List Cake

  GET /cakes
Parameter Type Description
limit string Optional. count limit data
page string Optional. show what page

Get Detail Cake

  GET /cakes/{id}
Parameter Type Description
id int Required. Id of cake to fetch

Add New Cake

  POST /cakes

in body raw add payload json like below

{
    "title" : "cake 3",
    "description": "desc cake",
    "rating" :7,
    "image" : "link image"
}

Edit Cake

  PUT /cakes/{id}
Parameter Type Description
id int Required. Id of cake to edit

in body raw add payload json like below

{
    "title" : "cake 3",
    "description": "desc cake",
    "rating" :7,
    "image" : "link image"
}

Delete Cake

  DELETE /cakes/{id}
Parameter Type Description
id int Required. Id of cake to delete

cakestore's People

Contributors

bangcodv 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.