All Projects → yang-f → Beauty

yang-f / Beauty

Licence: mit
A microframework based on mymysql,net/http,jwt-go and mux.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Beauty

Standards.rest
A collection of standards, specifications, etc. for HTTP API development.
Stars: ✭ 58 (-4.92%)
Mutual labels:  rest-api, restful-api
Simplog
A simple logger. No dependencies, no special features, just logging.
Stars: ✭ 17 (-72.13%)
Mutual labels:  simple, logging
Apidoc
RESTful API 文档生成工具,支持 Go、Java、Swift、JavaScript、Rust、PHP、Python、Typescript、Kotlin 和 Ruby 等大部分语言。
Stars: ✭ 785 (+1186.89%)
Mutual labels:  rest-api, restful-api
Openapi Generator
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
Stars: ✭ 10,634 (+17332.79%)
Mutual labels:  rest-api, restful-api
Generator Http Fake Backend
Yeoman generator for building a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 49 (-19.67%)
Mutual labels:  rest-api, restful-api
Modern Django
Modern Django: A Guide on How to Deploy Django-based Web Applications in 2017
Stars: ✭ 662 (+985.25%)
Mutual labels:  rest-api, restful-api
Gen
Converts a database into gorm structs and RESTful api
Stars: ✭ 825 (+1252.46%)
Mutual labels:  rest-api, restful-api
Restful Api Design References
RESTful API 设计参考文献列表,可帮助你更加彻底的了解REST风格的接口设计。
Stars: ✭ 4,830 (+7818.03%)
Mutual labels:  rest-api, restful-api
Djangorestframework Book
Django REST framework 3 中文文档, API参考, 最佳实践指南
Stars: ✭ 28 (-54.1%)
Mutual labels:  rest-api, restful-api
E Commerce 2 django
Guest register, user register, user login, user logout, account home page, product view history, change password, reset password, change name, send activation email when register, resend activation email, add shipping address, add billing address, add nickname to the addresses, edit shipping address, edit billing address, view list of your addresses, reuse shipping addresses when order products, reuse billing addresses when ordeer products, show sales analytics if staff or admin only using -chart.js-, get analytics data with Ajax, receive marketing email, change if user will receive marketing email or not by admin, send contact message with Ajax, products list, product detail, download product detail as a PDF file, download digital product files -if the user purchased that digital product only-, orders list, list of digital products files, order detail, download order detail as a PDF file, verify order ownership with Ajax -to secure order detail page-, show cart products, add or remove product from cart, checkout page, thanks page when order placed successfully, add or reuse payment method, add or reuse payment method with Ajax, search products by title, search products by description, search products by price, search products by tag title, write tags for products -by admin only-, auto fill contact email, full name if user logged in.
Stars: ✭ 20 (-67.21%)
Mutual labels:  rest-api, restful-api
Rest Api Design Guide
NBB's REST-ish API Design Guide
Stars: ✭ 643 (+954.1%)
Mutual labels:  rest-api, restful-api
Wp Rest Api Log
WordPress plugin for logging REST API requests and responses
Stars: ✭ 58 (-4.92%)
Mutual labels:  rest-api, logging
Django Rest Framework Tutorial
Django-REST-framework 基本教學 - 從無到有 DRF-Beginners-Guide 📝
Stars: ✭ 630 (+932.79%)
Mutual labels:  rest-api, restful-api
Koa2 Api Scaffold
一个基于Koa2的轻量级RESTful API Server脚手架。
Stars: ✭ 694 (+1037.7%)
Mutual labels:  rest-api, restful-api
Gf
GoFrame is a modular, powerful, high-performance and enterprise-class application development framework of Golang.
Stars: ✭ 6,501 (+10557.38%)
Mutual labels:  logging, session
Ngx Restangular
Restangular for Angular 2 and higher versions
Stars: ✭ 787 (+1190.16%)
Mutual labels:  rest-api, restful-api
Cerberus
A demonstration of a completely stateless and RESTful token-based authorization system using JSON Web Tokens (JWT) and Spring Security.
Stars: ✭ 482 (+690.16%)
Mutual labels:  rest-api, restful-api
Datafire
A framework for building integrations and APIs
Stars: ✭ 487 (+698.36%)
Mutual labels:  rest-api, restful-api
Farwest
Framework for building RESTful HATEOAS-driven applications.
Stars: ✭ 18 (-70.49%)
Mutual labels:  rest-api, restful-api
Calm
It is always Calm before a Tornado!
Stars: ✭ 50 (-18.03%)
Mutual labels:  rest-api, restful-api

GoDoc

A simple framwork written in golang.

You can build a simple restful project or a web application with it. If you dosen't want to use mysql db, you can implement your own Auth decorates and session.You can use your own DAO or whatever you like.

quick start:

  • run cmd

    mkdir demo && cd demo
    go get gopkg.in/alecthomas/kingpin.v2
    go get github.com/yang-f/beauty
    
  • add $GOPATH/bin to your $PATH

  • run cmd beauty

    usage: beauty [<flags>] <command> [<args> ...]
    
    A command-line tools of beauty.
    
    Flags:
      --help  Show context-sensitive help (also try --help-long and --help-man).
    
    Commands:
      help [<command>...]
        Show help.
    
      demo
        Demo of web server.
    
      generate <name>
        Generate a new app.
    
  • test beauty

    beauty demo
    
  • then

    2017/05/04 16:21:05 start server on port :8080
    
  • visit 127.0.0.1:8080

    {"description":"this is json"}
    
  • visit 127.0.0.1:8080/demo1

    {"description":"this is json"}
    

How to use:

  • Generate new app

    beauty generate yourAppName
    
  • dir list

    GOPATH/src/yourAppName
    ├── controllers
    │   ├── adminController.go
    │   └── controller_test.go
    ├── decorates
    |   └── http.go
    ├── main.go
    ├── models
    ├── tpl
    └── utils
    
  • about Route

    • demo
        r := router.New()
    
        r.GET("/", controllers.Config().ContentJSON())
    
        r.GET("/demo1", controllers.Config().ContentJSON().Verify())
    
    
  • token generate

    tokenString, err := token.Generate(fmt.Sprintf("%v|%v", user_id, user_pass))
    
    
  • demo

    package main
    
    import (
        "net/http"
        "log"
        "github.com/yang-f/beauty/consts/contenttype"
        "github.com/yang-f/beauty/router"
        "github.com/yang-f/beauty/settings"
        "github.com/yang-f/beauty/controllers"
        "github.com/yang-f/beauty/decorates"
    
    )
    
    func main() {
    
        log.Printf("start server on port %s", settings.Listen)
    
        settings.Listen = ":8080"
    
        settings.Domain = "yourdomain.com"
    
        settings.DefaultOrigin = "http://defaultorigin.com"
    
        settings.HmacSampleSecret = "whatever"
    
        r := router.New()
    
        r.GET("/", controllers.Config().ContentJSON())
    
        r.GET("/demo1", controllers.Config().ContentJSON().Verify())
    
        log.Fatal(http.ListenAndServe(settings.Listen, r))
    }
    

Support:

  • token
settings.HmacSampleSecret = "whatever"

token, err := token.Generate(origin)

origin, err := token.Valid(token)
  • cors

    • static file server
    router.PathPrefix("/static/").Handler(http.StripPrefix("/static/", decorates.CorsHeader2(http.FileServer(http.Dir("/your/static/path")))))
    
    • api etc:
      • default is cors
  • error handler

    func XxxxController() decorates.Handler{
        return func (w http.ResponseWriter, r *http.Request) *models.APPError {
            xxx,err := someOperation()
            if err != nil{
                return &models.APPError {err, Message, Code, Status}
            }
            ...
            return nil
        }
    }
    
  • utils

    • Response
    • Rand
    • MD5
    • Post
  • test

    • go test -v -bench=".*"
    • go test -v -short $(go list ./... | grep -v /vendor/)
    • ...

Contributing:

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

TODO:

  • [x] Cmd tools
  • [ ] Improve document
  • [ ] Role review
  • [ ] Error handler
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].