Git Product home page Git Product logo

62stingray's Introduction

62stingray

62stingray is a REST API written in Golang designed to manage user defined cart data and can run independly as a stateless service.

The main goal of 62stingray is to reduce repetition of creating and managing cart data.

Created by 62teknologi.com, perfected by Community.

Cart

This introduction will help You explain the concept and characteristic of cart.

Concept

Cart refers to a virtual container or a shopping cart that allows users to gather and store items they wish to purchase from an online store.

In the context of a 62stingray, a cart need has certain Information and Behaviors. Additionally, a cart also can have information of User Defined Data.

You will learn how to define data on later section.

Information

  • Must Have ID
  • Must Have User/Guest ID
  • Must Have Product ID
  • Must Have Created At
  • Must Have Updated At
  • Must Have Deleted At

Behaviors

  • can be retrieved
  • can be added
  • can be synched
  • can be deleted

Running 62stingray

Follow the instruction below to running 62stingray on Your local machine.

Prerequisites

Make sure to have preinstalled this prerequisites app before You continue to installation manual. we don't include how to install these app below most of this prerequisites is a free app which You can find the "How to" installation tutorial anywhere in web and different machine OS have different way to install.

  • MySql
  • Go

Installation manual

This installation manual will guide You to running the binary on Your ubuntu or mac terminal.

  1. Clone the repository
git clone https://github.com/62teknologi/62stingray
  1. Change directory to the cloned repository
cd 62stingray
  1. Initiate the submodule
git submodule update --init
  1. Create .env base on .env.example
cp .env.example .env
  1. Change DB variable on .env using Your mysql configuration or the staging database on cloud server eg
HTTP_SERVER_ADDRESS=0.0.0.0:10082
DB_DRIVER=mysql
DB_SOURCE_1=root@tcp(127.0.0.1:3306)/stingray_local
  1. Build the binary
go build main.go
  1. Run the server
./main

The API server will start running on http://localhost:10082. You can now interact with the API using Your preferred API client or through the command line with curl.

API Endpoints

Retrieve Cart List

Endpoint

GET /api/v1/carts

Parameter

Name Def Description
page 1 return response in pagination format, eg: page=1 will return first page of the response
per_page 30 set how many data per pagination response
search null filter response by string
order null order data by one or multiple field, eg: order=name+asc or order[]=name+asc&order[]=created_at+desc
:field null filter specific column You want, eg: if Your cart have user_id field then You can add user_id=1 to params for searching all cart where user_id is 1. it support multi value by sending user_id[] instead user_id

Add to Cart

Endpoint

GET /api/v1/carts

Parameter

Name Def Description
:field null field You want to insert
user_id null identify the cart owner, for example You can use Your user session id for Your aunthicated user or sort of web cookies id for Your guest user
product_id null identify the product of cart, for example You can use Your item_id, book_id, food_id etc

Synch cart

Endpoint

PUT /api/v1/carts

Parameter

Name Def Description
ids[] null cart id that You want to synch
quantities[] null quantity of product in cart that You want to synch. Quantity length need to be the same with id length
user_id null identify the cart owner You want to synch. Synch will not have effect if user_id not found

Delete cart

Endpoint

DEL /api/v1/carts/:user_id/:id

Set Up a cart

  • WIP

Generate cart

  • WIP

Set Information

  • WIP

Set Validation

  • WIP

Set Associations

  • WIP

Set Filterable

  • WIP

Set Summary

  • WIP

Set Operation

  • WIP

Contributing

If You'd like to contribute to the development of the 62stingray REST API, please follow these steps:

  1. Fork the repository
  2. Create a new branch for Your feature or bugfix
  3. Commit Your changes to the branch
  4. Create a pull request, describing the changes You've made

We appreciate Your contributions and will review Your pull request as soon as possible.

Must Preserve Characteristic

  • Reduce repetition
  • Easy to use REST API
  • Easy to setup
  • Easy to Customizable
  • high performance
  • Robust data validation and error handling
  • Well documented API endpoints

License

This project is licensed under the MIT License. For more information, please see the LICENSE file.

About 62

E.nam\Du.a

Indonesian language; spelling: A-num\Due-wa

Origin: Enam Dua means ‘six-two’ or sixty two. It is Indonesia’s international country code (+62), that was also used as a meme word for “Indonesia” by “Indonesian internet citizen” (netizen) in social media.

62stingray's People

Contributors

hifebriansyah avatar fajar7xx avatar yanralapdy avatar dimasbagussusilo avatar

Watchers

Yobi Bina Setiawan avatar  avatar

Forkers

yanralapdy

62stingray's Issues

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.