项目作者: skizhak

项目描述 :
APIs in GO, NodeJS app
高级语言: Go
项目地址: git://github.com/skizhak/echodemo.git
创建时间: 2017-03-09T19:05:55Z
项目社区:https://github.com/skizhak/echodemo

开源协议:

下载


About

Simple learning project

Backend: GO Echo

Frontend: NodeJS app
ES6, SCSS, Handlebars, Material Design, Webpack

Installation

clone this repo.

  1. cd echodemo
  2. go get -u github.com/kardianos/govendor
  3. govendor sync
  1. cd web
  2. npm install
  3. npm run build
  4. (npm run dev for dev environment)

MySql

setup mysql and create user and database.
user: ‘echodemo’ with password ‘demo123’
db: ‘echodemo’

  1. mysql -u root -p -e "create user 'echodemo'@'localhost' identified by 'demo123'; grant all privileges on * . * to 'echodemo'@'localhost'; flush privileges; drop database if exists echodemo; create database echodemo;"

Let’s use goose for db migration.

  1. go get bitbucket.org/liamstask/goose/cmd/goose

check you’re able to connect to db using the config file under db

  1. goose status

Now, apply the migration

  1. goose up

Stripe API

  1. update with your Stripe API Keys in resources/controller.go and web/dist/index.html

Start the server

  1. go run main.go

Load broswer, point to http://localhost:9001

APIs

  1. "/api/hello"
  2. GET: Simple "hello world"
  3. "/users"
  4. GET : List of users
  5. POST: Create new user
  6. "/users/:id"
  7. GET: Get a particular user
  8. "/users/:id/payments"
  9. GET: Get payments of a user
  10. POST: Post payment for a user

Dev Note

sqlboiler is part of vendor, but if new models needs to be generated, install it

  1. go get github.com/vattle/sqlboiler

update the db tables, and run

  1. go generate