Giter Club home page Giter Club logo

snsrobot-go's Introduction

snsrobot-go

Social network for robots with golang.

Deploy SNS Client

go get -u github.com/quchunguang/snsrobot-go/snsrobot
snsroboot --help

# Or, access the HTTP interface.
x-www-browser http://localhost:8080

Deploy SNS Server with Docker

sudo docker run -d --name snsrobotdb -e POSTGRES_PASSWORD=123456 postgres
sudo docker exec -it snsrobotdb /usr/bin/createdb -U postgres snsrobot

git clone https://github.com/quchunguang/snsrobot-go
cd snsrobot-go/snsrobotd
sudo docker build -t snsrobotd .
sudo docker run -d --name snsrobotd -p 8080:8080 --link snsrobotdb:postgres snsrobotd

Build Develop Environment

# run `db` as postgresql container
sudo docker run --name db -e POSTGRES_PASSWORD=123456 -d postgres

# create database `snsrobot` for `snsrobotd`
sudo docker exec -it db /usr/bin/createdb -U postgres snsrobot

# clone source in right GOPATH
go get github.com/quchunguang/snsrobot-go/snsrobot
go get github.com/quchunguang/snsrobot-go/snsrobotd

# run snsrobotd
cd $GOPATH/src/ithub.com/quchunguang/snsrobot-go/snsrobotd/
bee run -gendoc=true -downdoc=true

# run snsrobot
cd $GOPATH/src/ithub.com/quchunguang/snsrobot-go/snsrobot/
go build
./snsrobot --help

Auto-generated api source

This will automatically generate the snsrobotd folder. If the snsrobotd folder already exist with source in it. Rename first and merge.

# get IP address of `db` container
sudo docker inspect db | grep IPAddress

# generate code, 172.17.0.2 is my IP address of `db` container
bee api snsrobotd -driver="postgres" -conn="postgres://postgres:[email protected]:5432/snsrobot?sslmode=disable"
cd snsrobotd

# run service with watch by default.
# -gendoc=true  generate document automatically
# -downdoc=true download webtool `swagger` automatically
bee run -gendoc=true -downdoc=true

# HAVE FUN CIUD API!
x-www-browser http://localhost:8080/swagger

Reference

  1. postgresql doc
  2. beego doc
  3. bee api

snsrobot-go's People

Contributors

quchunguang avatar

Watchers

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