Giter Club home page Giter Club logo

hydra-go's Introduction

Hydra Go

A multi-project API system.

Features:

  • create REST API using specific endpoints (called collections)
  • basic auth for admin routes
  • built using Gin, a Mongo DB is required

To do:

  • projects management

hydra

Admin examples

# Basic auth - auth credentials are loaded from AuthCollection (see Conf)
curl -u 'username:password' 'http://localhost:8080/admin/projects'
# list all projects
curl 'http://127.0.0.1:8080/admin/projects'
# create a new project (ex. hydra1)
curl -X POST 'http://127.0.0.1:8080/admin/projects' -H 'Content-Type: application/json' --data '{"data":{"name":"hydra1","description":"Hydra 1","collections":[]}}'
# read a specific project (ex. hydra1)
curl 'http://127.0.0.1:8080/admin/projects/hydra1'
# update project - create collection (ex. hydra1 - articles)
curl -X PUT 'http://127.0.0.1:8080/admin/projects/hydra1' -H 'Content-Type: application/json' --data '{"data":{"collections":[{"name":"articles","singular":"article","columns":{"title":{"type":"String"},"email":{"type":"String","validations":"required,email"},"description":{"type":"String"},"position":{"type":"Float"},"published":{"type":"Boolean"},"dt":{"type":"DateTime"}}}]}}'
# destroy a specific project (ex. hydra1)
curl -X DELETE 'http://127.0.0.1:8080/admin/projects/hydra1'

Api examples

# list the content of a collection (ex. articles)
curl 'http://127.0.0.1:8080/api/hydra1/articles'
# create an entry for the content of a collection (ex. articles)
curl -X POST 'http://127.0.0.1:8080/api/hydra1/articles' -H 'Content-Type: application/json' --data '{"data":{"title":"A test"}}'
# read an entry of the content of a collection (ex. articles)
curl 'http://127.0.0.1:8080/api/hydra1/articles/59e3b9b7d23d8028efd327c4'
# update an entry for the content of a collection (ex. articles)
curl -X PUT 'http://127.0.0.1:8080/api/hydra1/articles/59e3b9b7d23d8028efd327c4' -H 'Content-Type: application/json' --data '{"data":{"title":"A test 2"}}'
# destroy an entry for the content of a collection (ex. articles)
curl -X DELETE 'http://127.0.0.1:8080/api/hydra1/articles/59e3b9b7d23d8028efd327c4'

hydra-go's People

Watchers

James Cloos avatar Mattia Roccoberton 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.