All Projects → jaggerwang → Zqc Server Demo

jaggerwang / Zqc Server Demo

Lite version of zaiqiuchang api server, which developed by go and deploy using docker. It also can be used as a starter kit for developing api server.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Zqc Server Demo

Graphiti
Stylish Graph APIs
Stars: ✭ 783 (+586.84%)
Mutual labels:  api-server
Kuzzle
Open-source Back-end, self-hostable & ready to use - Real-time, storage, advanced search - Web, Apps, Mobile, IoT -
Stars: ✭ 991 (+769.3%)
Mutual labels:  api-server
Plumber
Turn your R code into a web API.
Stars: ✭ 1,160 (+917.54%)
Mutual labels:  api-server
Goapiserver
A golang api server demo that contains usage of Redis and MySQL.
Stars: ✭ 22 (-80.7%)
Mutual labels:  api-server
Mythra
Music retrieval CLI and API using rust
Stars: ✭ 37 (-67.54%)
Mutual labels:  api-server
Aws Serverless Java Container
A Java wrapper to run Spring, Jersey, Spark, and other apps inside AWS Lambda.
Stars: ✭ 1,054 (+824.56%)
Mutual labels:  api-server
Lithium
Easy to use C++17 HTTP Server with no compromise on performances. https://matt-42.github.io/lithium
Stars: ✭ 523 (+358.77%)
Mutual labels:  api-server
Graphql devise
GraphQL interface on top devise_token_auth
Stars: ✭ 100 (-12.28%)
Mutual labels:  api-server
Spyne
A transport agnostic sync/async RPC library that focuses on exposing services with a well-defined API using popular protocols.
Stars: ✭ 992 (+770.18%)
Mutual labels:  api-server
Aceql Http
AceQL HTTP is a framework of REST like http APIs that allow to access to remote SQL databases over http from any device that supports http.
Stars: ✭ 68 (-40.35%)
Mutual labels:  api-server
Brocade.io
Open GTIN / barcode & product database
Stars: ✭ 24 (-78.95%)
Mutual labels:  api-server
Thinkphp5 Restfulapi
restful-api风格接口 APP接口 APP接口权限 oauth2.0 接口版本管理 接口鉴权
Stars: ✭ 949 (+732.46%)
Mutual labels:  api-server
Rest Layer
REST Layer, Go (golang) REST API framework
Stars: ✭ 1,068 (+836.84%)
Mutual labels:  api-server
Zato
ESB, SOA, REST, APIs and Cloud Integrations in Python
Stars: ✭ 889 (+679.82%)
Mutual labels:  api-server
Doesangue Core
Online platform that connects people interested in blood donation
Stars: ✭ 91 (-20.18%)
Mutual labels:  api-server
Nei Toolkit
NEI 接口文档管理平台配套自动化工具
Stars: ✭ 781 (+585.09%)
Mutual labels:  api-server
Vaxic
Node HTTP server framework
Stars: ✭ 45 (-60.53%)
Mutual labels:  api-server
Go Sdk
A composable toolbox of libraries to build everything from CLIs to enterprise applications.
Stars: ✭ 103 (-9.65%)
Mutual labels:  api-server
Appy Backend
A user system to bootstrap your app.
Stars: ✭ 96 (-15.79%)
Mutual labels:  api-server
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 (+9228.07%)
Mutual labels:  api-server

Zaiqiuchang server demo

Zaiqiuchang(在球场) is a mobile app developed using React Native, both iOS and Android are supported. This project is the lite version of the api server, which developed in Go, and deploy using Docker. The lite version only include account related apis, but it should be a good start to develop your own.

Packages

Package Description
github.com/labstack/echo Http server and framework.
github.com/spf13/cobra CLI app framework.
github.com/spf13/viper Manage app configuration.
github.com/asaskevich/govalidator Validate input.
github.com/Sirupsen/logrus Logging.
gopkg.in/mgo.v2 Mongodb driver.
github.com/garyburd/redigo/redis Redis driver.
github.com/gorilla/sessions Manage user session.
github.com/smartystreets/goconvey/convey Test framework.

How to deploy

You need install docker engine first.

run in dev mode with auto detecting code change

> git clone [email protected]:jaggerwang/zqc-server-demo.git && cd zqc-server-demo
> mkdir -p ~/data/projects/zqc-server-demo # create directory for data volumes
> ./deploy.sh # pull images and run containers
> ./fswatch.sh # watching code change, fswatch needed

The data and log of server, mongodb and redis will be saved at host's path "~/data/projects/zqc-server-demo", which mounted at container's path "/data".

run in prod mode

> git clone [email protected]:jaggerwang/zqc-server-demo.git && cd zqc-server-demo
> mkdir -p /data/zqc-server-demo # create directory for data volumes
> ./deploy-prod.sh

The data and log of server, mongodb and redis will be saved at host's path "/data/zqc-server-demo", which mounted at container's path "/data".

run test

> cd zqc-server-demo
> ./test.sh
...
2017/02/11 16:01:03 parser.go:24: [passed]: zqc/test
2017/02/11 16:01:03 executor.go:69: Executor status: 'idle'

Script tesh.sh will run a new group of docker containers to run unittests, including server, mongodb and redis. The new group has separated volumes and ports, to avoid empty the existing data. We use goconvey to write and run unittests. It supplied a web console to show the test result, and will run test automatically when detected code change.

Open url "http://localhost:10402/" to view test result.

build image of your own

> cd zqc-server-demo
> ./docker-build.sh

Command

help

> cd zqc-server-demo
> docker-compose -p zqc-server-demo exec server zqc
Zai qiu chang app.

Usage:
  zqc [command]

Available Commands:
  db          Database admin
  server      Run server

Flags:
  -c, --config string              config file (default "./config.json")
      --dir.data string            directory for saving runtime data
      --env string                 deployment environment
      --log.level string           log filter level
      --mongodb.zqc.addrs string   address of zqc db

Use "zqc [command] --help" for more information about a command.

create mongodb index

> cd zqc-server-demo
> docker-compose -p zqc-server-demo exec server zqc db createIndexes

When deploy, it will auto run this command to create mongodb index. So normally you do not need to do this by your own.

API

The server container exposed port 1323, and it mapped to port 10400 of the host. So you can use domain "http://localhost:10400" to access the following api.

Path Method Description
/register POST Register account.
/login GET Login.
/isLogined GET Check whether logined.
/logout GET Logout.
/account/edit POST Edit account profile.
/account/info GET Get current account info.
/user/info GET Get user info by id.
/user/infos GET Get user info by ids.

FAQ

How to change image repository?

Search and replace all "daocloud.io/jaggerwang/zqc-server-demo" to your own.

How can I build the base images of this project, including go, mongodb and redis?

The dockerfiles of the base images can be found at "https://github.com/jaggerwang/jw-dockerfiles".

Other resources

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