Browse Source

initial commit

Luis Figueiredo 8 years ago
commit
5e046887fb
65 changed files with 1555 additions and 0 deletions
  1. BIN
      DIST/bin/server
  2. BIN
      DIST/bin/simple-cli
  3. 1 0
      DIST/public/index.html
  4. 1 0
      DIST/public/static/css/app.fe643711e36d0de2db8f0f3fc42820bd.css
  5. 1 0
      DIST/public/static/css/app.fe643711e36d0de2db8f0f3fc42820bd.css.map
  6. 2 0
      DIST/public/static/js/app.4a00cf8a9f85d2f217dd.js
  7. 1 0
      DIST/public/static/js/app.4a00cf8a9f85d2f217dd.js.map
  8. 2 0
      DIST/public/static/js/manifest.423dc1228d530dce66a9.js
  9. 1 0
      DIST/public/static/js/manifest.423dc1228d530dce66a9.js.map
  10. 7 0
      DIST/public/static/js/vendor.d4b81fedd239e7b8b5bf.js
  11. 1 0
      DIST/public/static/js/vendor.d4b81fedd239e7b8b5bf.js.map
  12. 14 0
      Dockerfile
  13. 28 0
      Makefile
  14. 3 0
      README.md
  15. 1 0
      backend/.goproj
  16. 109 0
      backend/README.md
  17. BIN
      backend/bin/simple-web
  18. BIN
      backend/pkg/linux_amd64/core.a
  19. BIN
      backend/pkg/linux_amd64/core/usersvc.a
  20. BIN
      backend/pkg/linux_amd64/server.a
  21. BIN
      backend/pkg/linux_amd64/simple-web/core.a
  22. BIN
      backend/pkg/linux_amd64/simple-web/core/usersvc.a
  23. 11 0
      backend/src/simple-web/cmd/server/server.go
  24. 92 0
      backend/src/simple-web/cmd/simple-cli/main.go
  25. 60 0
      backend/src/simple-web/core/core.go
  26. 21 0
      backend/src/simple-web/core/session.go
  27. 17 0
      backend/src/simple-web/core/usersvc/models.go
  28. 100 0
      backend/src/simple-web/core/usersvc/service.go
  29. 80 0
      backend/src/simple-web/server/http.go
  30. 24 0
      build.sh
  31. 15 0
      docker-compose.yml
  32. 16 0
      frontend/web/.babelrc
  33. 9 0
      frontend/web/.editorconfig
  34. 2 0
      frontend/web/.eslintignore
  35. 32 0
      frontend/web/.eslintrc.js
  36. 5 0
      frontend/web/.gitignore
  37. 8 0
      frontend/web/.postcssrc.js
  38. 12 0
      frontend/web/.tern-project
  39. 21 0
      frontend/web/README.md
  40. 35 0
      frontend/web/build/build.js
  41. 45 0
      frontend/web/build/check-versions.js
  42. 9 0
      frontend/web/build/dev-client.js
  43. 81 0
      frontend/web/build/dev-server.js
  44. 71 0
      frontend/web/build/utils.js
  45. 12 0
      frontend/web/build/vue-loader.conf.js
  46. 66 0
      frontend/web/build/webpack.base.conf.js
  47. 35 0
      frontend/web/build/webpack.dev.conf.js
  48. 116 0
      frontend/web/build/webpack.prod.conf.js
  49. 6 0
      frontend/web/config/dev.env.js
  50. 38 0
      frontend/web/config/index.js
  51. 3 0
      frontend/web/config/prod.env.js
  52. 1 0
      frontend/web/dist
  53. 11 0
      frontend/web/index.html
  54. 71 0
      frontend/web/package.json
  55. 79 0
      frontend/web/src/App.vue
  56. BIN
      frontend/web/src/assets/logo.png
  57. 14 0
      frontend/web/src/assets/mixin.styl
  58. 30 0
      frontend/web/src/assets/style.styl
  59. 38 0
      frontend/web/src/components/Hello.vue
  60. 45 0
      frontend/web/src/components/Test.vue
  61. 14 0
      frontend/web/src/main.js
  62. 14 0
      frontend/web/src/router/index.js
  63. 0 0
      frontend/web/static/.gitkeep
  64. 11 0
      old/docker-compose.yml
  65. 13 0
      test/docker-compose.yml

BIN
DIST/bin/server


BIN
DIST/bin/simple-cli


+ 1 - 0
DIST/public/index.html

@@ -0,0 +1 @@
+<!DOCTYPE html><html><head><meta charset=utf-8><title>simple-frontend</title><link href=/static/css/app.fe643711e36d0de2db8f0f3fc42820bd.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.423dc1228d530dce66a9.js></script><script type=text/javascript src=/static/js/vendor.d4b81fedd239e7b8b5bf.js></script><script type=text/javascript src=/static/js/app.4a00cf8a9f85d2f217dd.js></script></body></html>

File diff suppressed because it is too large
+ 1 - 0
DIST/public/static/css/app.fe643711e36d0de2db8f0f3fc42820bd.css


File diff suppressed because it is too large
+ 1 - 0
DIST/public/static/css/app.fe643711e36d0de2db8f0f3fc42820bd.css.map


File diff suppressed because it is too large
+ 2 - 0
DIST/public/static/js/app.4a00cf8a9f85d2f217dd.js


File diff suppressed because it is too large
+ 1 - 0
DIST/public/static/js/app.4a00cf8a9f85d2f217dd.js.map


File diff suppressed because it is too large
+ 2 - 0
DIST/public/static/js/manifest.423dc1228d530dce66a9.js


File diff suppressed because it is too large
+ 1 - 0
DIST/public/static/js/manifest.423dc1228d530dce66a9.js.map


File diff suppressed because it is too large
+ 7 - 0
DIST/public/static/js/vendor.d4b81fedd239e7b8b5bf.js


File diff suppressed because it is too large
+ 1 - 0
DIST/public/static/js/vendor.d4b81fedd239e7b8b5bf.js.map


+ 14 - 0
Dockerfile

@@ -0,0 +1,14 @@
+#FROM golang:1.8.0-alpine
+#FROM iron/base
+FROM scratch
+
+ADD DIST /goapp
+#ENV DBHOST db
+WORKDIR /goapp
+
+ENTRYPOINT ["./bin/server"]
+
+
+
+
+

+ 28 - 0
Makefile

@@ -0,0 +1,28 @@
+
+#@mkdir -o DIST/bin
+#@mkdir -o DIST/public
+
+all: backend frontend
+
+docker: Dockerfile
+	docker build --rm -t hexasoftware.com:5000/myapp .
+
+deploy: docker
+	docker push hexasoftware.com:5000/myapp
+
+backend: backend/src/simple-web/cmd/server/server.go 
+	@echo "Building backend...  $(pwd)"
+	CGO_ENABLED=0 go build -o DIST/bin/server backend/src/simple-web/cmd/server/server.go
+
+frontend: frontend/web/package.json
+	@echo "Building frontend..."
+	# Frontend
+	@cd frontend/web;node build/build.js
+
+test: backend
+	cd DIST;tmux split "DBHOST=localhost PORT=8080 DEVMODE=1 bin/server"
+	cd frontend/web; npm run dev
+
+.PHONY: all test clean
+
+

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
+
+Builds should go straight to DIST and DIST would be deployed to docker
+

+ 1 - 0
backend/.goproj

@@ -0,0 +1 @@
+simple-backend

+ 109 - 0
backend/README.md

@@ -0,0 +1,109 @@
+Simple-backend
+--------------------
+
+Projet structure
+
+Backend -
+
+
+Core -
+	Services	
+		usersvc,
+		imagesvc,
+		etcsvc
+
+
+```
+Browser       WebHandler       Services       DataStore
+   |               |              |               |
+   |-request------>|              |               |
+   |               |              |               |
+   |               |-call-------->|               |
+   |               |              |               |
+   |               |              |-query-------->|
+   |               |              |               |
+   |               |              |<---------data-|
+   |               |              |               |
+   |               |<------return-|               |               
+   |               |              |               |
+   |<-----response-|              |               |
+   |               |              |               |
+   |               |              |               |
+Browser       WebHandler       Services       DataStore
+```
+
+(Browser), (WebHandler), (Services), (DataStore)
+
+in MVC we have Model View Controller in same "project" despite this is some what organized it will tie some logic to project,
+in most projects this is also fine, but ends up later to some recoding in different projects repeat all over again.
+
+Also in regular .NET web projects we have 
+
+```
+Persistence:
+	Proj.Data.Contacts   
+		Model
+	Proj.Data            
+		ModelRepository
+Logic:
+	Proj.Business        
+		ModelBO 
+	Proj.Web
+		Controllers
+		Views
+
+as Views are Processed and sent to browser,
+Controllers receive request and go to ModelBO retrieving Contacts, it return a view which are processed and sent back to server
+
+```	
+
+The goal
+Create independent contexts:
+```
+Persistence:
+	Pkg.DataStore - persistence
+UserService:  
+	Pkg.UserModel
+	Pkg.UserLogic (service entry point)
+ImageService:
+	Pkg.ImageModel
+	Pkg.ImageLogic
+```
+
+The caller must be independent from browser, we can create different front ends such as CLI.
+
+Service can require more than one Querier, we can create virtual DB with tables
+
+Logic:
+	
+
+WebProject
+	ViewModel
+	Controllers
+	Views (cshtml)
+
+
+
+
+DataStore data persistence
+Service performs logic, validation, authorization
+Communication receives
+
+
+tests
+------
+
+
+With independent services we should have a maincore:
+
+```go
+	Core will prepare the database, session etc
+
+	core.Session();
+
+	core.User().Login etc
+
+
+
+
+

BIN
backend/bin/simple-web


BIN
backend/pkg/linux_amd64/core.a


BIN
backend/pkg/linux_amd64/core/usersvc.a


BIN
backend/pkg/linux_amd64/server.a


BIN
backend/pkg/linux_amd64/simple-web/core.a


BIN
backend/pkg/linux_amd64/simple-web/core/usersvc.a


+ 11 - 0
backend/src/simple-web/cmd/server/server.go

@@ -0,0 +1,11 @@
+package main
+
+import (
+	_ "hexasoftware/lib/prettylog/global"
+	"simple-web/server"
+)
+
+func main() {
+
+	server.Start()
+}

+ 92 - 0
backend/src/simple-web/cmd/simple-cli/main.go

@@ -0,0 +1,92 @@
+package main
+
+import (
+	"core"
+	"log"
+	"regexp"
+	"strings"
+
+	"github.com/chzyer/readline"
+)
+
+// Helper
+type Param []string
+
+func (p Param) String() string {
+	var str = ""
+	for i, v := range p {
+		if i != 0 {
+			str += ", "
+		}
+		str += "'" + v + "'"
+	}
+	return str
+}
+
+func main() {
+	//mgo.SetDebug(true)
+	//mgo.SetLogger(log.New(os.Stderr, "MGO: ", 0))
+
+	rl, err := readline.New("> ")
+	if err != nil {
+		panic(err)
+	}
+
+	for {
+		line, err := rl.Readline()
+		if err == readline.ErrInterrupt {
+			log.Println("Exiting...")
+			return
+		}
+		// Process line
+		//log.Println("Processing line", line)
+
+		cmdParam := []string{}
+		// Split line properly
+		quotePart := strings.Split(line, "\"")
+		re := regexp.MustCompile("\\s+")
+		for i, p := range quotePart { // Even is normal odd is quoted
+			if i&1 == 0 { // Even
+				s := re.Split(strings.TrimSpace(p), -1)
+				cmdParam = append(cmdParam, s...)
+				continue
+			}
+			cmdParam = append(cmdParam, p) // Add full string
+		}
+		log.Println("Process cmds", len(cmdParam), Param(cmdParam))
+
+		if cmdParam[0] == "user" {
+			if len(cmdParam) == 1 {
+				continue
+			}
+			// User Processor
+			if cmdParam[1] == "new" {
+
+				if len(cmdParam) != 6 {
+					log.Println("Invalid param should be: user new [name] [description] [email] [passw]")
+					continue
+				}
+				// ENV based config, docker friendly
+				c := core.New()
+
+				// Session on the core
+				s := c.Session()
+
+				s.User().NewUser(cmdParam[2], cmdParam[3], cmdParam[4], cmdParam[5])
+				// Login:
+				//u, err := s.Login("stdiopt@gmail.com", "1q2w3e")
+				u, err := s.User().Login("admin", "1q2w3e")
+				if err != nil {
+					panic(err)
+				}
+				log.Println("User logged in:", u)
+
+				//res := s.MustList()
+				//log.Println("Res:", res)
+
+			}
+		}
+
+	}
+
+}

+ 60 - 0
backend/src/simple-web/core/core.go

@@ -0,0 +1,60 @@
+package core
+
+import (
+	"fmt"
+	"log"
+	"os"
+
+	mgo "gopkg.in/mgo.v2-unstable"
+)
+
+type Core struct {
+	session *mgo.Session
+	// Options..
+}
+
+func Demo() *Core {
+	c := New()
+
+	c.session.DB("mgo-test").C("users").DropCollection()
+	var err error
+	us := c.Session().User()
+	if err = us.NewUser("admin", "Administration account", "admin@domain.tld", "pwd"); err != nil {
+		log.Println("Error adding demo user", err)
+	}
+	if err = us.NewUser("user1", "user account", "user1@domain.tld", "pwd"); err != nil {
+		log.Println("Error adding demo user", err)
+	}
+	if err = us.NewUser("user2", "user account", "user2@domain.tld", "pwd"); err != nil {
+		log.Println("Error adding demo user", err)
+	}
+	if err = us.NewUser("user3", "user account", "user3@domain.tld", "pwd"); err != nil {
+		log.Println("Error adding demo user", err)
+	}
+
+	return c
+}
+
+func New() *Core {
+	mongoHost := os.Getenv("DBHOST")
+	if mongoHost == "" {
+		mongoHost = "mongodb" // Defaults to
+	}
+	log.Println("MongoHost", mongoHost)
+	mongodsn := fmt.Sprintf("mongodb://%s", mongoHost)
+	//session, err := mgo.Dial("mongodb://admin:1q2w3e@localhost/mgo-test")
+	session, err := mgo.Dial(mongodsn)
+	if err != nil {
+		panic(err)
+	}
+
+	return &Core{session}
+}
+
+// Prepare everything
+
+func (c *Core) Session() *Session {
+	nsess := c.session.Copy()
+
+	return &Session{nsess}
+}

+ 21 - 0
backend/src/simple-web/core/session.go

@@ -0,0 +1,21 @@
+package core
+
+import (
+	"hexasoftware/x/hqi"
+	"hexasoftware/x/hqi/drv/mgodrv"
+	"simple-web/core/usersvc"
+
+	mgo "gopkg.in/mgo.v2-unstable"
+)
+
+type Session struct {
+	session *mgo.Session
+
+	// Session based stuff
+}
+
+func (s *Session) User() *usersvc.Service {
+	coll := s.session.DB("mgo-test").C("users")
+	q := hqi.NewQuery(&mgodrv.Driver{coll})
+	return usersvc.New(q)
+}

+ 17 - 0
backend/src/simple-web/core/usersvc/models.go

@@ -0,0 +1,17 @@
+package usersvc
+
+type (
+	//User base user model
+	User struct {
+		ID          string `bson:"_id" hqi:",omitempty"`
+		Name        string `hqi:",omitempty"`
+		Description string `hqi:",omitempty"`
+		// Password
+		Accounts []UserAccount `hqi:",omitempty"`
+	}
+	//UserAccount links
+	UserAccount struct {
+		Kind string            `hqi:",omitempty"`
+		Data map[string]string `hqi:",omitempty"`
+	}
+)

+ 100 - 0
backend/src/simple-web/core/usersvc/service.go

@@ -0,0 +1,100 @@
+package usersvc
+
+import (
+	"errors"
+	"hexasoftware/x/hqi"
+	"log"
+
+	"github.com/google/uuid"
+)
+
+type Service struct {
+	q hqi.Query
+}
+
+func New(q hqi.Query) *Service {
+	// Reusable session
+	return &Service{q}
+}
+
+func (s *Service) NewUser(name string, desc string, email string, password string) error {
+
+	{
+		var res []User
+		s.q.Find(hqi.M{"Name": name}).
+			List(&res)
+		if len(res) > 0 {
+			return errors.New("User name Already exists")
+		}
+	}
+	{
+		var res []User
+		s.q.Find(hqi.M{"Accounts": hqi.M{"Kind": "email", "Data": hqi.M{"email": email}}}).
+			List(&res)
+
+		if len(res) > 0 {
+			return errors.New("User Email Already exists")
+		}
+	}
+
+	nUser := User{
+		ID:          uuid.New().String(),
+		Name:        name,
+		Description: desc,
+		Accounts: []UserAccount{{
+			Kind: "email",
+			Data: map[string]string{"email": email, "pwd": password},
+		}},
+	}
+	return s.q.Insert(&nUser)
+}
+
+//Login entry can be email, username, mobilephone
+func (s *Service) Login(entry string, password string) (*User, error) {
+	byName := User{
+		Name: entry,
+		Accounts: []UserAccount{
+			{Kind: "email", Data: map[string]string{"pwd": password}},
+		},
+	}
+	// Above should be Name entry email password AND test 1
+	//log.Println("byName:", byName)
+
+	/*hqi.M{
+		"Name":     entry,
+		"Accounts": hqi.M{"Kind": "email", "Data": hqi.M{"pwd": password}},
+	}*/
+	/*byEmail := hqi.M{
+		"Accounts": hqi.M{
+			"Kind": "email",
+			"Data": hqi.M{
+				"email": entry,
+				"pwd":   password,
+			},
+		},
+	}*/
+	var res []User
+	err := s.q.Find(byName).List(&res)
+	if err != nil {
+		return nil, err
+	}
+	log.Println("Login:", res)
+	if len(res) == 0 {
+		return nil, errors.New("Not found")
+	}
+	if len(res) > 1 {
+		return nil, errors.New("Result should be 1")
+	}
+
+	return &res[0], nil
+}
+
+func (s *Service) MustList() []User {
+	var res []User
+	err := s.q.Find().List(&res)
+	if err != nil {
+		panic(err)
+	}
+
+	return res
+}

+ 80 - 0
backend/src/simple-web/server/http.go

@@ -0,0 +1,80 @@
+package server
+
+import (
+	"encoding/json"
+	"fmt"
+	"log"
+	"net/http"
+	"net/http/httputil"
+	"net/url"
+	"os"
+	"path/filepath"
+	"simple-web/core"
+	"strings"
+)
+
+var (
+	c = core.Demo()
+)
+
+// list users
+func helloHandler(w http.ResponseWriter, r *http.Request) {
+	w.Header().Set("Content-type", "application/json")
+	s := c.Session()
+	res := s.User().MustList()
+
+	jenc := json.NewEncoder(w)
+	jenc.SetIndent(" ", " ")
+	jenc.Encode(res)
+
+	// Lets list users and show them
+}
+
+// Create an handler that serves a file or if doesn not exists send it too index.html
+
+func vserve() http.HandlerFunc {
+	absPath, _ := filepath.Abs("public")
+	log.Println("static:", absPath)
+
+	return func(w http.ResponseWriter, r *http.Request) {
+		lpath, err := filepath.Abs(filepath.Join("public", r.URL.Path[1:]))
+		if err != nil || !strings.HasPrefix(lpath, absPath) {
+			http.ServeFile(w, r, "public/index.html")
+			return
+		}
+		if _, err := os.Stat(lpath); os.IsNotExist(err) {
+			http.ServeFile(w, r, "public/index.html")
+			return
+		}
+		http.ServeFile(w, r, lpath)
+	}
+}
+
+func Start() {
+	// Do this in some cmd line
+	s := c.Session()
+	s.User().NewUser("admin", "Administration account", "admin@domain.tld", "1q2w3e")
+
+	mux := http.NewServeMux()
+	mux.HandleFunc("/api", helloHandler)
+
+	if os.Getenv("DEVMODE") != "" {
+		log.Println("Developer mode")
+		u, _ := url.Parse("http://localhost:3000")
+		mux.Handle("/", httputil.NewSingleHostReverseProxy(u))
+	} else {
+		log.Println("Production")
+		mux.HandleFunc("/", vserve())
+	}
+	// Dev
+	//mux.HandleFunc("/", proxyDev)
+	// Prod
+
+	port := os.Getenv("PORT")
+	if port == "" {
+		port = "8080"
+	}
+	log.Println("Server Starting at :", port)
+	http.ListenAndServe(fmt.Sprintf(":%s", port), mux)
+
+}

+ 24 - 0
build.sh

@@ -0,0 +1,24 @@
+#!/bin/sh
+
+if [ "x$1" == "xdocker" ] ; then
+	docker build --rm -t hexasoftware.com:5000/myapp .
+	exit
+fi
+
+mkdir -p DIST/bin
+mkdir -p DIST/public
+
+echo "Building backend..."
+# Backend
+pushd DIST/bin
+CGO_ENABLED=0 go build  ../../backend/src/cmd/simple-cli
+CGO_ENABLED=0 go build ../../backend/src/cmd/server
+popd
+
+echo "Building frontend..."
+# Frontend
+pushd frontend/web
+node build/build.js
+popd
+
+

+ 15 - 0
docker-compose.yml

@@ -0,0 +1,15 @@
+version: '2'
+services:
+  dev-myapp:
+    build: .
+    environment:
+      - DBHOST=dev-mongo
+    ports:
+      - "8080:8080"
+  dev-mongo:
+    image: "mongo"
+    ports:
+      - "27017:27017"
+    volumes:
+      - "/home/stdio/mongodb:/data/db"
+      

+ 16 - 0
frontend/web/.babelrc

@@ -0,0 +1,16 @@
+{
+  "presets": [
+    ["latest", {
+      "es2015": { "modules": false }
+    }],
+    "stage-2"
+  ],
+  "plugins": ["transform-runtime"],
+  "comments": false,
+  "env": {
+    "test": {
+      "presets": ["latest", "stage-2"],
+      "plugins": [ "istanbul" ]
+    }
+  }
+}

+ 9 - 0
frontend/web/.editorconfig

@@ -0,0 +1,9 @@
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true

+ 2 - 0
frontend/web/.eslintignore

@@ -0,0 +1,2 @@
+build/*.js
+config/*.js

+ 32 - 0
frontend/web/.eslintrc.js

@@ -0,0 +1,32 @@
+// http://eslint.org/docs/user-guide/configuring
+
+module.exports = {
+  root: true,
+  parser: 'babel-eslint',
+  parserOptions: {
+    sourceType: 'module'
+  },
+  env: {
+    browser: true,
+  },
+  // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
+  extends: 'standard',
+  // required to lint *.vue files
+  plugins: [
+    'html'
+  ],
+  // add your custom rules here
+  'rules': {
+		'quotes':[1,'double'],
+		'no-tabs':0,
+		'indent':[1,'tab'],
+		'space-before-function-paren':0,
+		'disallowTabs':0,
+    // allow paren-less arrow functions
+    'arrow-parens': 0,
+    // allow async-await
+    'generator-star-spacing': 0,
+    // allow debugger during development
+    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
+  }
+}

+ 5 - 0
frontend/web/.gitignore

@@ -0,0 +1,5 @@
+.DS_Store
+node_modules/
+dist/
+npm-debug.log
+yarn-error.log

+ 8 - 0
frontend/web/.postcssrc.js

@@ -0,0 +1,8 @@
+// https://github.com/michael-ciniawsky/postcss-load-config
+
+module.exports = {
+  "plugins": {
+    // to edit target browsers: use "browserlist" field in package.json
+    "autoprefixer": {}
+  }
+}

+ 12 - 0
frontend/web/.tern-project

@@ -0,0 +1,12 @@
+{
+  "ecmaVersion": 6,
+  "libs": [
+    "browser"
+  ],
+  "loadEagerly": [
+    "./src/"
+  ],
+  "dontLoad": [
+    "./node-modules"
+  ]
+}

+ 21 - 0
frontend/web/README.md

@@ -0,0 +1,21 @@
+# simple-frontend
+
+> A Vue.js project
+
+## Build Setup
+
+``` bash
+# install dependencies
+npm install
+
+# serve with hot reload at localhost:8080
+npm run dev
+
+# build for production with minification
+npm run build
+
+# build for production and view the bundle analyzer report
+npm run build --report
+```
+
+For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).

+ 35 - 0
frontend/web/build/build.js

@@ -0,0 +1,35 @@
+require('./check-versions')()
+
+process.env.NODE_ENV = 'production'
+
+var ora = require('ora')
+var rm = require('rimraf')
+var path = require('path')
+var chalk = require('chalk')
+var webpack = require('webpack')
+var config = require('../config')
+var webpackConfig = require('./webpack.prod.conf')
+
+var spinner = ora('building for production...')
+spinner.start()
+
+rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
+  if (err) throw err
+  webpack(webpackConfig, function (err, stats) {
+    spinner.stop()
+    if (err) throw err
+    process.stdout.write(stats.toString({
+      colors: true,
+      modules: false,
+      children: false,
+      chunks: false,
+      chunkModules: false
+    }) + '\n\n')
+
+    console.log(chalk.cyan('  Build complete.\n'))
+    console.log(chalk.yellow(
+      '  Tip: built files are meant to be served over an HTTP server.\n' +
+      '  Opening index.html over file:// won\'t work.\n'
+    ))
+  })
+})

+ 45 - 0
frontend/web/build/check-versions.js

@@ -0,0 +1,45 @@
+var chalk = require('chalk')
+var semver = require('semver')
+var packageConfig = require('../package.json')
+
+function exec (cmd) {
+  return require('child_process').execSync(cmd).toString().trim()
+}
+
+var versionRequirements = [
+  {
+    name: 'node',
+    currentVersion: semver.clean(process.version),
+    versionRequirement: packageConfig.engines.node
+  },
+  {
+    name: 'npm',
+    currentVersion: exec('npm --version'),
+    versionRequirement: packageConfig.engines.npm
+  }
+]
+
+module.exports = function () {
+  var warnings = []
+  for (var i = 0; i < versionRequirements.length; i++) {
+    var mod = versionRequirements[i]
+    if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
+      warnings.push(mod.name + ': ' +
+        chalk.red(mod.currentVersion) + ' should be ' +
+        chalk.green(mod.versionRequirement)
+      )
+    }
+  }
+
+  if (warnings.length) {
+    console.log('')
+    console.log(chalk.yellow('To use this template, you must update following to modules:'))
+    console.log()
+    for (var i = 0; i < warnings.length; i++) {
+      var warning = warnings[i]
+      console.log('  ' + warning)
+    }
+    console.log()
+    process.exit(1)
+  }
+}

+ 9 - 0
frontend/web/build/dev-client.js

@@ -0,0 +1,9 @@
+/* eslint-disable */
+require('eventsource-polyfill')
+var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
+
+hotClient.subscribe(function (event) {
+  if (event.action === 'reload') {
+    window.location.reload()
+  }
+})

+ 81 - 0
frontend/web/build/dev-server.js

@@ -0,0 +1,81 @@
+require('./check-versions')()
+
+var config = require('../config')
+if (!process.env.NODE_ENV) {
+  process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
+}
+
+var opn = require('opn')
+var path = require('path')
+var express = require('express')
+var webpack = require('webpack')
+var proxyMiddleware = require('http-proxy-middleware')
+var webpackConfig = require('./webpack.dev.conf')
+
+// default port where dev server listens for incoming traffic
+var port = process.env.PORT || config.dev.port
+// automatically open browser, if not set will be false
+var autoOpenBrowser = !!config.dev.autoOpenBrowser
+// Define HTTP proxies to your custom API backend
+// https://github.com/chimurai/http-proxy-middleware
+var proxyTable = config.dev.proxyTable
+
+var app = express()
+var compiler = webpack(webpackConfig)
+
+var devMiddleware = require('webpack-dev-middleware')(compiler, {
+  publicPath: webpackConfig.output.publicPath,
+  quiet: true
+})
+
+var hotMiddleware = require('webpack-hot-middleware')(compiler, {
+  log: () => {}
+})
+// force page reload when html-webpack-plugin template changes
+compiler.plugin('compilation', function (compilation) {
+  compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
+    hotMiddleware.publish({ action: 'reload' })
+    cb()
+  })
+})
+
+// proxy api requests
+Object.keys(proxyTable).forEach(function (context) {
+  var options = proxyTable[context]
+  if (typeof options === 'string') {
+    options = { target: options }
+  }
+  app.use(proxyMiddleware(options.filter || context, options))
+})
+
+// handle fallback for HTML5 history API
+app.use(require('connect-history-api-fallback')())
+
+// serve webpack bundle output
+app.use(devMiddleware)
+
+// enable hot-reload and state-preserving
+// compilation error display
+app.use(hotMiddleware)
+
+// serve pure static assets
+var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
+app.use(staticPath, express.static('./static'))
+
+var uri = 'http://localhost:' + port
+
+devMiddleware.waitUntilValid(function () {
+  console.log('> Listening at ' + uri + '\n')
+})
+
+module.exports = app.listen(port, function (err) {
+  if (err) {
+    console.log(err)
+    return
+  }
+
+  // when env is testing, don't need open it
+  if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
+    opn(uri)
+  }
+})

+ 71 - 0
frontend/web/build/utils.js

@@ -0,0 +1,71 @@
+var path = require('path')
+var config = require('../config')
+var ExtractTextPlugin = require('extract-text-webpack-plugin')
+
+exports.assetsPath = function (_path) {
+  var assetsSubDirectory = process.env.NODE_ENV === 'production'
+    ? config.build.assetsSubDirectory
+    : config.dev.assetsSubDirectory
+  return path.posix.join(assetsSubDirectory, _path)
+}
+
+exports.cssLoaders = function (options) {
+  options = options || {}
+
+  var cssLoader = {
+    loader: 'css-loader',
+    options: {
+      minimize: process.env.NODE_ENV === 'production',
+      sourceMap: options.sourceMap
+    }
+  }
+
+  // generate loader string to be used with extract text plugin
+  function generateLoaders (loader, loaderOptions) {
+    var loaders = [cssLoader]
+    if (loader) {
+      loaders.push({
+        loader: loader + '-loader',
+        options: Object.assign({}, loaderOptions, {
+          sourceMap: options.sourceMap
+        })
+      })
+    }
+
+    // Extract CSS when that option is specified
+    // (which is the case during production build)
+    if (options.extract) {
+      return ExtractTextPlugin.extract({
+        use: loaders,
+        fallback: 'vue-style-loader'
+      })
+    } else {
+      return ['vue-style-loader'].concat(loaders)
+    }
+  }
+
+  // http://vuejs.github.io/vue-loader/en/configurations/extract-css.html
+  return {
+    css: generateLoaders(),
+    postcss: generateLoaders(),
+    less: generateLoaders('less'),
+    sass: generateLoaders('sass', { indentedSyntax: true }),
+    scss: generateLoaders('sass'),
+    stylus: generateLoaders('stylus'),
+    styl: generateLoaders('stylus')
+  }
+}
+
+// Generate loaders for standalone style files (outside of .vue)
+exports.styleLoaders = function (options) {
+  var output = []
+  var loaders = exports.cssLoaders(options)
+  for (var extension in loaders) {
+    var loader = loaders[extension]
+    output.push({
+      test: new RegExp('\\.' + extension + '$'),
+      use: loader
+    })
+  }
+  return output
+}

+ 12 - 0
frontend/web/build/vue-loader.conf.js

@@ -0,0 +1,12 @@
+var utils = require('./utils')
+var config = require('../config')
+var isProduction = process.env.NODE_ENV === 'production'
+
+module.exports = {
+  loaders: utils.cssLoaders({
+    sourceMap: isProduction
+      ? config.build.productionSourceMap
+      : config.dev.cssSourceMap,
+    extract: isProduction
+  })
+}

+ 66 - 0
frontend/web/build/webpack.base.conf.js

@@ -0,0 +1,66 @@
+var path = require('path')
+var utils = require('./utils')
+var config = require('../config')
+var vueLoaderConfig = require('./vue-loader.conf')
+
+function resolve (dir) {
+  return path.join(__dirname, '..', dir)
+}
+
+module.exports = {
+  entry: {
+    app: './src/main.js'
+  },
+  output: {
+    path: config.build.assetsRoot,
+    filename: '[name].js',
+    publicPath: process.env.NODE_ENV === 'production'
+      ? config.build.assetsPublicPath
+      : config.dev.assetsPublicPath
+  },
+  resolve: {
+    extensions: ['.js', '.vue', '.json'],
+    alias: {
+      '@': resolve('src'),
+    }
+  },
+  module: {
+    rules: [
+      /*{
+        test: /\.(js|vue)$/,
+        loader: 'eslint-loader',
+        enforce: "pre",
+        include: [resolve('src'), resolve('test')],
+        options: {
+          formatter: require('eslint-friendly-formatter')
+        }
+      },*/
+      {
+        test: /\.vue$/,
+        loader: 'vue-loader',
+        options: vueLoaderConfig
+      },
+      {
+        test: /\.js$/,
+        loader: 'babel-loader',
+        include: [resolve('src'), resolve('test')]
+      },
+      {
+        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
+        loader: 'url-loader',
+        query: {
+          limit: 10000,
+          name: utils.assetsPath('img/[name].[hash:7].[ext]')
+        }
+      },
+      {
+        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
+        loader: 'url-loader',
+        query: {
+          limit: 10000,
+          name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
+        }
+      }
+    ]
+  }
+}

+ 35 - 0
frontend/web/build/webpack.dev.conf.js

@@ -0,0 +1,35 @@
+var utils = require('./utils')
+var webpack = require('webpack')
+var config = require('../config')
+var merge = require('webpack-merge')
+var baseWebpackConfig = require('./webpack.base.conf')
+var HtmlWebpackPlugin = require('html-webpack-plugin')
+var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
+
+// add hot-reload related code to entry chunks
+Object.keys(baseWebpackConfig.entry).forEach(function (name) {
+  baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
+})
+
+module.exports = merge(baseWebpackConfig, {
+  module: {
+    rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
+  },
+  // cheap-module-eval-source-map is faster for development
+  devtool: '#cheap-module-eval-source-map',
+  plugins: [
+    new webpack.DefinePlugin({
+      'process.env': config.dev.env
+    }),
+    // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
+    new webpack.HotModuleReplacementPlugin(),
+    new webpack.NoEmitOnErrorsPlugin(),
+    // https://github.com/ampedandwired/html-webpack-plugin
+    new HtmlWebpackPlugin({
+      filename: 'index.html',
+      template: 'index.html',
+      inject: true
+    }),
+    new FriendlyErrorsPlugin()
+  ]
+})

+ 116 - 0
frontend/web/build/webpack.prod.conf.js

@@ -0,0 +1,116 @@
+var path = require('path')
+var utils = require('./utils')
+var webpack = require('webpack')
+var config = require('../config')
+var merge = require('webpack-merge')
+var baseWebpackConfig = require('./webpack.base.conf')
+var CopyWebpackPlugin = require('copy-webpack-plugin')
+var HtmlWebpackPlugin = require('html-webpack-plugin')
+var ExtractTextPlugin = require('extract-text-webpack-plugin')
+var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
+
+var env = config.build.env
+
+var webpackConfig = merge(baseWebpackConfig, {
+  module: {
+    rules: utils.styleLoaders({
+      sourceMap: config.build.productionSourceMap,
+      extract: true
+    })
+  },
+  devtool: config.build.productionSourceMap ? '#source-map' : false,
+  output: {
+    path: config.build.assetsRoot,
+    filename: utils.assetsPath('js/[name].[chunkhash].js'),
+    chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
+  },
+  plugins: [
+    // http://vuejs.github.io/vue-loader/en/workflow/production.html
+    new webpack.DefinePlugin({
+      'process.env': env
+    }),
+    new webpack.optimize.UglifyJsPlugin({
+      compress: {
+        warnings: false
+      },
+      sourceMap: true
+    }),
+    // extract css into its own file
+    new ExtractTextPlugin({
+      filename: utils.assetsPath('css/[name].[contenthash].css')
+    }),
+    // Compress extracted CSS. We are using this plugin so that possible
+    // duplicated CSS from different components can be deduped.
+    new OptimizeCSSPlugin(),
+    // generate dist index.html with correct asset hash for caching.
+    // you can customize output by editing /index.html
+    // see https://github.com/ampedandwired/html-webpack-plugin
+    new HtmlWebpackPlugin({
+      filename: config.build.index,
+      template: 'index.html',
+      inject: true,
+      minify: {
+        removeComments: true,
+        collapseWhitespace: true,
+        removeAttributeQuotes: true
+        // more options:
+        // https://github.com/kangax/html-minifier#options-quick-reference
+      },
+      // necessary to consistently work with multiple chunks via CommonsChunkPlugin
+      chunksSortMode: 'dependency'
+    }),
+    // split vendor js into its own file
+    new webpack.optimize.CommonsChunkPlugin({
+      name: 'vendor',
+      minChunks: function (module, count) {
+        // any required modules inside node_modules are extracted to vendor
+        return (
+          module.resource &&
+          /\.js$/.test(module.resource) &&
+          module.resource.indexOf(
+            path.join(__dirname, '../node_modules')
+          ) === 0
+        )
+      }
+    }),
+    // extract webpack runtime and module manifest to its own file in order to
+    // prevent vendor hash from being updated whenever app bundle is updated
+    new webpack.optimize.CommonsChunkPlugin({
+      name: 'manifest',
+      chunks: ['vendor']
+    }),
+    // copy custom static assets
+    new CopyWebpackPlugin([
+      {
+        from: path.resolve(__dirname, '../static'),
+        to: config.build.assetsSubDirectory,
+        ignore: ['.*']
+      }
+    ])
+  ]
+})
+
+if (config.build.productionGzip) {
+  var CompressionWebpackPlugin = require('compression-webpack-plugin')
+
+  webpackConfig.plugins.push(
+    new CompressionWebpackPlugin({
+      asset: '[path].gz[query]',
+      algorithm: 'gzip',
+      test: new RegExp(
+        '\\.(' +
+        config.build.productionGzipExtensions.join('|') +
+        ')$'
+      ),
+      threshold: 10240,
+      minRatio: 0.8
+    })
+  )
+}
+
+if (config.build.bundleAnalyzerReport) {
+  var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
+  webpackConfig.plugins.push(new BundleAnalyzerPlugin())
+}
+
+module.exports = webpackConfig

+ 6 - 0
frontend/web/config/dev.env.js

@@ -0,0 +1,6 @@
+var merge = require('webpack-merge')
+var prodEnv = require('./prod.env')
+
+module.exports = merge(prodEnv, {
+  NODE_ENV: '"development"'
+})

+ 38 - 0
frontend/web/config/index.js

@@ -0,0 +1,38 @@
+// see http://vuejs-templates.github.io/webpack for documentation.
+var path = require('path')
+
+module.exports = {
+  build: {
+    env: require('./prod.env'),
+    index: path.resolve(__dirname, '../dist/index.html'),
+    assetsRoot: path.resolve(__dirname, '../dist'),
+    assetsSubDirectory: 'static',
+    assetsPublicPath: '/',
+    productionSourceMap: true,
+    // Gzip off by default as many popular static hosts such as
+    // Surge or Netlify already gzip all static assets for you.
+    // Before setting to `true`, make sure to:
+    // npm install --save-dev compression-webpack-plugin
+    productionGzip: false,
+    productionGzipExtensions: ['js', 'css'],
+    // Run the build command with an extra argument to
+    // View the bundle analyzer report after build finishes:
+    // `npm run build --report`
+    // Set to `true` or `false` to always turn it on or off
+    bundleAnalyzerReport: process.env.npm_config_report
+  },
+  dev: {
+    env: require('./dev.env'),
+    port: 3000,
+    autoOpenBrowser: true,
+    assetsSubDirectory: 'static',
+    assetsPublicPath: '/',
+    proxyTable: {},
+    // CSS Sourcemaps off by default because relative paths are "buggy"
+    // with this option, according to the CSS-Loader README
+    // (https://github.com/webpack/css-loader#sourcemaps)
+    // In our experience, they generally work as expected,
+    // just be aware of this issue when enabling this option.
+    cssSourceMap: false
+  }
+}

+ 3 - 0
frontend/web/config/prod.env.js

@@ -0,0 +1,3 @@
+module.exports = {
+  NODE_ENV: '"production"'
+}

+ 1 - 0
frontend/web/dist

@@ -0,0 +1 @@
+../../DIST/public/

+ 11 - 0
frontend/web/index.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>simple-frontend</title>
+  </head>
+  <body>
+    <div id="app"></div>
+    <!-- built files will be auto injected -->
+  </body>
+</html>

+ 71 - 0
frontend/web/package.json

@@ -0,0 +1,71 @@
+{
+  "name": "simple-frontend",
+  "version": "1.0.0",
+  "description": "A Vue.js project",
+  "author": "Luis Figueiredo",
+  "private": true,
+  "scripts": {
+    "dev": "node build/dev-server.js",
+    "build": "node build/build.js",
+    "lint": "eslint --ext .js,.vue src"
+  },
+  "dependencies": {
+    "vue": "^2.2.1",
+    "vue-router": "^2.2.0"
+  },
+  "devDependencies": {
+    "autoprefixer": "^6.7.2",
+    "axios": "^0.15.3",
+    "babel-core": "^6.22.1",
+    "babel-eslint": "^7.1.1",
+    "babel-loader": "^6.2.10",
+    "babel-plugin-transform-runtime": "^6.22.0",
+    "babel-preset-latest": "^6.22.0",
+    "babel-preset-stage-2": "^6.22.0",
+    "babel-register": "^6.22.0",
+    "chalk": "^1.1.3",
+    "connect-history-api-fallback": "^1.3.0",
+    "copy-webpack-plugin": "^4.0.1",
+    "css-loader": "^0.26.1",
+    "eslint": "^3.14.1",
+    "eslint-config-standard": "^6.2.1",
+    "eslint-friendly-formatter": "^2.0.7",
+    "eslint-loader": "^1.6.1",
+    "eslint-plugin-html": "^2.0.0",
+    "eslint-plugin-promise": "^3.4.0",
+    "eslint-plugin-standard": "^2.0.1",
+    "eventsource-polyfill": "^0.9.6",
+    "express": "^4.14.1",
+    "extract-text-webpack-plugin": "^2.0.0",
+    "file-loader": "^0.10.0",
+    "friendly-errors-webpack-plugin": "^1.1.3",
+    "function-bind": "^1.1.0",
+    "html-webpack-plugin": "^2.28.0",
+    "http-proxy-middleware": "^0.17.3",
+    "opn": "^4.0.2",
+    "optimize-css-assets-webpack-plugin": "^1.3.0",
+    "ora": "^1.1.0",
+    "rimraf": "^2.6.0",
+    "semver": "^5.3.0",
+    "stylus": "^0.54.5",
+    "stylus-loader": "^2.5.0",
+    "url-loader": "^0.5.7",
+    "vue-loader": "^11.1.4",
+    "vue-style-loader": "^2.0.0",
+    "vue-template-compiler": "^2.2.1",
+    "webpack": "^2.2.1",
+    "webpack-bundle-analyzer": "^2.2.1",
+    "webpack-dev-middleware": "^1.10.0",
+    "webpack-hot-middleware": "^2.16.1",
+    "webpack-merge": "^2.6.1"
+  },
+  "engines": {
+    "node": ">= 4.0.0",
+    "npm": ">= 3.0.0"
+  },
+  "browserlist": [
+    "> 1%",
+    "last 2 versions",
+    "not ie <= 8"
+  ]
+}

+ 79 - 0
frontend/web/src/App.vue

@@ -0,0 +1,79 @@
+<template>
+	<div id="app">
+		<div class="menu">
+			<ul>
+				<li><router-link to="/" exact>Home</router-link></li>
+				<li><router-link to="test">Test</router-link></li>
+			</ul>
+		</div>
+		<div class="main">
+			<h1>{{ $route.name }}</h1>
+			<div class="route-container">
+				<router-view></router-view>
+			</div>
+			<small>v3</small>
+		</div>
+	</div>
+</template>
+
+<script>
+	export default {
+		name: "app",
+		data: {
+			cname: ""
+		}
+	}
+</script>
+
+<style lang="stylus">
+	@import "assets/mixin.styl"
+	@import "assets/style.styl"
+
+	* 
+		box-sizing:border-box
+
+	body 
+		padding:0px
+		margin:0px
+
+	#app 
+			font-family: 'Avenir', Helvetica, Arial, sans-serif
+			-webkit-font-smoothing: antialiased
+			-moz-osx-font-smoothing: grayscale
+			height:100vh
+			display:flex
+			flex-direction:row
+			color: #2c3e50
+
+	.main 
+		padding-top:100px
+		padding:10px
+		flex-grow:1
+		display:flex
+		flex-direction:column
+		.route-container
+			padding:20px
+			flex-grow:1
+
+	.menu 
+		padding-top:120px
+		flex-basis:250px
+		background:#555
+		color:#FFF
+		ul 
+			list-style-type:none
+			margin:0px
+			padding:0px
+			li a 
+				display:block
+				padding:18px 20px
+				text-align:center
+				text-decoration: none
+				color: #EFEFEF
+				&.router-link-active
+					//linear_gradient(left,#555,#fff)
+					background:#FFF
+					color:#222
+				&:hover:not(.router-link-active)
+					background: #F53
+</style>

BIN
frontend/web/src/assets/logo.png


+ 14 - 0
frontend/web/src/assets/mixin.styl

@@ -0,0 +1,14 @@
+
+linear_gradient(origin, colors...)
+    
+  fallback = colors[1][0]
+
+  colors = join(', ', colors)
+  colors = unquote(colors)
+
+  background-color: fallback
+  background-image: -webkit-linear-gradient(origin, colors) // Chrome, Safari
+  background-image:    -moz-linear-gradient(origin, colors) // Firefox (3.6 - 15)
+  background-image:     -ms-linear-gradient(origin, colors) // IE 10
+  background-image:      -o-linear-gradient(origin, colors) // Opera (11.1 - 12.0) 
+  background-image:         linear-gradient(origin, colors) // W3C

+ 30 - 0
frontend/web/src/assets/style.styl

@@ -0,0 +1,30 @@
+table
+	width:100%;
+	border-collapse: collapse;
+	border:none
+	thead 
+		border-bottom: 1px solid rgba(50,50,50,0.1)
+
+
+	tbody	
+		tr:hover 
+			cursor:pointer
+			background:#EEE
+
+
+	td,th 
+		text-align:left
+		padding:15px
+	td.number, th.number 
+		text-align:right
+
+
+
+
+
+
+//table,td,th 
+//	border: 1px solid rgba(100,100,100,0.2)
+			
+
+

+ 38 - 0
frontend/web/src/components/Hello.vue

@@ -0,0 +1,38 @@
+<template>
+  <div class="hello">
+    <h1>{{ msg }}</h1>
+  </div>
+</template>
+
+<script>
+	export default {
+		name: "hello",
+
+		data () {
+			return {
+				msg: "Testing update"
+			}
+		}
+	}
+</script>
+
+<!-- Add "scoped" attribute to limit CSS to this component only -->
+<style scoped>
+h1, h2 {
+  font-weight: normal;
+}
+
+ul {
+  list-style-type: none;
+  padding: 0;
+}
+
+li {
+  display: inline-block;
+  margin: 0 10px;
+}
+
+a {
+  color: #42b983;
+}
+</style>

+ 45 - 0
frontend/web/src/components/Test.vue

@@ -0,0 +1,45 @@
+<template>
+	<div class="test">
+		<table>
+			<thead>
+				<tr>
+					<th>Name</th>
+					<th>Description</th>
+					<th>Email</th>
+					<th class="number">Number</th>
+				</tr>
+			</thead>
+			<tbody>
+				<tr v-for="v in users">
+					<td>{{v.Name}}</td>
+					<td>{{v.Description}}</td>
+					<td>{{v.Accounts[0].Data.email}}</td>
+					<td class="number">0</td>
+				</tr>
+			</tbody>
+		</table>
+	</div>
+</template>
+
+
+<script>
+	import axios from "axios"
+
+	export default {
+		name: "test",
+		data() {
+			return {
+				users: []
+			}
+		},
+		mounted () {
+			// Check dev or not?
+			var target = window.location.hostname + ":8080"
+			axios.get("http://" + target + "/api")
+				.then((res) => {
+					this.users = res.data
+				})
+		}
+
+	}
+</script>

+ 14 - 0
frontend/web/src/main.js

@@ -0,0 +1,14 @@
+import Vue from 'vue'
+import App from './App'
+import router from './router'
+
+Vue.config.productionTip = false
+
+/* eslint-disable no-new */
+new Vue({
+
+
+  el: '#app',
+  router,
+  render: h => h(App)
+})

+ 14 - 0
frontend/web/src/router/index.js

@@ -0,0 +1,14 @@
+import Vue from "vue"
+import Router from "vue-router"
+import Hello from "@/components/Hello"
+import Test from "@/components/Test"
+
+Vue.use(Router)
+
+export default new Router({
+	mode: "history",
+	routes: [
+		{ path: "/", name: "Beautiful home", component: Hello },
+		{ path: "/test", name: "The test table", component: Test }
+	]
+})

+ 0 - 0
frontend/web/static/.gitkeep


+ 11 - 0
old/docker-compose.yml

@@ -0,0 +1,11 @@
+version: '2'
+services:
+  web:
+    build: .
+    ports:
+      - "8080:8080"
+  mongodb:
+    image: "mongo"
+    volumes:
+      - "/home/stdio/mongodb:/data/db"
+      

+ 13 - 0
test/docker-compose.yml

@@ -0,0 +1,13 @@
+version: '2'                                                                                                                                                                                                    
+services:                                                                                                                                                                                                       
+  web:                                                                                                                                                                                                          
+    image: "hexasoftware.com:5000/myapp"                                                                                                                                                                        
+    # image: f080690e516f                                                                                                                                                                                       
+    restart: always                                                                                                                                                                                             
+    ports:                                                                                                                                                                                                      
+      - "8080:8080"                                                                                                                                                                                             
+  mongodb:                                                                                                                                                                                                      
+    image: "mongo"                                                                                                                                                                                              
+    volumes:                                                                                                                                                                                                    
+      - "/home/stdio/hexasoftware/database:/data/db"                                                                                                                                                            
+    restart: always