reformat van backend naar fullstack
This commit is contained in:
parent
4c432e8841
commit
4aa6d1fedd
@ -1,4 +1,4 @@
|
||||
name: build and run backend
|
||||
name: build and deploy portfolio
|
||||
|
||||
on:
|
||||
push:
|
||||
@ -21,9 +21,9 @@ jobs:
|
||||
- name: Docker login
|
||||
run: docker login docker.kleinwizard.nl -u Darius -p ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Build the Docker image
|
||||
run: docker build . --file Dockerfile --tag docker.kleinwizard.nl/portfolio-backend:latest
|
||||
run: docker build . --file Dockerfile --tag docker.kleinwizard.nl/portfolio:latest
|
||||
- name: Docker push
|
||||
run: docker push docker.kleinwizard.nl/portfolio-backend:latest
|
||||
run: docker push docker.kleinwizard.nl/portfolio:latest
|
||||
|
||||
|
||||
publish:
|
||||
@ -38,6 +38,6 @@ jobs:
|
||||
- name: Docker login
|
||||
run: docker login docker.kleinwizard.nl -u Darius -p ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Docker pull
|
||||
run: docker pull docker.kleinwizard.nl/portfolio-backend
|
||||
run: docker pull docker.kleinwizard.nl/portfolio
|
||||
- name: Docker run
|
||||
run: docker run --rm -d -p 4002:4002 --name portfolioApi docker.kleinwizard.nl/portfolio-backend
|
||||
run: docker run --rm -d -p 4002:4002 --name portfolioApi docker.kleinwizard.nl/portfolio
|
||||
@ -1,25 +0,0 @@
|
||||
package handler
|
||||
|
||||
import "net/http"
|
||||
|
||||
func CatchAllHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusGone)
|
||||
_, err := w.Write([]byte("Bad endpoint"))
|
||||
if err != nil {
|
||||
InternalServerErrorHandler(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandler(w http.ResponseWriter, r *http.Request) {
|
||||
_, err := w.Write([]byte("test"))
|
||||
if err != nil {
|
||||
InternalServerErrorHandler(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
func Test2Handler(w http.ResponseWriter, r *http.Request) {
|
||||
_, err := w.Write([]byte("test2"))
|
||||
if err != nil {
|
||||
InternalServerErrorHandler(w, r)
|
||||
}
|
||||
}
|
||||
11
backend/api/handler/mainHandler.go
Normal file
11
backend/api/handler/mainHandler.go
Normal file
@ -0,0 +1,11 @@
|
||||
package handler
|
||||
|
||||
import "net/http"
|
||||
|
||||
func CatchAllHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusGone)
|
||||
_, err := w.Write([]byte("Bad endpoint"))
|
||||
if err != nil {
|
||||
InternalServerErrorHandler(w, r)
|
||||
}
|
||||
}
|
||||
@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"portfolio-backend/database/ent"
|
||||
"portfolio-backend/database/query"
|
||||
"portfolio/backend/database/ent"
|
||||
"portfolio/backend/database/query"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"github.com/joho/godotenv"
|
||||
"log"
|
||||
"os"
|
||||
"portfolio-backend/database/ent"
|
||||
"portfolio/backend/database/ent"
|
||||
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
)
|
||||
@ -9,11 +9,11 @@ import (
|
||||
"log"
|
||||
"reflect"
|
||||
|
||||
"portfolio-backend/database/ent/migrate"
|
||||
"portfolio/backend/database/ent/migrate"
|
||||
|
||||
"portfolio-backend/database/ent/project"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database/ent/project"
|
||||
"portfolio/backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/user"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect"
|
||||
@ -6,9 +6,9 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"portfolio-backend/database/ent/project"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database/ent/project"
|
||||
"portfolio/backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/user"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
@ -4,11 +4,11 @@ package enttest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"portfolio-backend/database/ent"
|
||||
"portfolio/backend/database/ent"
|
||||
// required by schema hooks.
|
||||
_ "portfolio-backend/database/ent/runtime"
|
||||
_ "portfolio/backend/database/ent/runtime"
|
||||
|
||||
"portfolio-backend/database/ent/migrate"
|
||||
"portfolio/backend/database/ent/migrate"
|
||||
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
)
|
||||
@ -5,7 +5,7 @@ package hook
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"portfolio-backend/database/ent"
|
||||
"portfolio/backend/database/ent"
|
||||
)
|
||||
|
||||
// The ProjectFunc type is an adapter to allow the use of ordinary
|
||||
@ -6,10 +6,10 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio-backend/database/ent/project"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/project"
|
||||
"portfolio/backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/user"
|
||||
"sync"
|
||||
|
||||
"entgo.io/ent"
|
||||
@ -4,8 +4,8 @@ package ent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"portfolio-backend/database/ent/project"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/project"
|
||||
"portfolio/backend/database/ent/team"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
@ -3,7 +3,7 @@
|
||||
package project
|
||||
|
||||
import (
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -6,8 +6,8 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"portfolio-backend/database/ent/project"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/project"
|
||||
"portfolio/backend/database/ent/team"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
@ -4,8 +4,8 @@ package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio-backend/database/ent/project"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/project"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -6,9 +6,9 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio-backend/database/ent/project"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/project"
|
||||
"portfolio/backend/database/ent/team"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -6,9 +6,9 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio-backend/database/ent/project"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/project"
|
||||
"portfolio/backend/database/ent/team"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -3,8 +3,8 @@
|
||||
package ent
|
||||
|
||||
import (
|
||||
"portfolio-backend/database/ent/schema"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database/ent/schema"
|
||||
"portfolio/backend/database/ent/user"
|
||||
)
|
||||
|
||||
// The init function reads all schema descriptors with runtime code
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
package runtime
|
||||
|
||||
// The schema-stitching logic is generated in portfolio-backend/database/ent/runtime.go
|
||||
// The schema-stitching logic is generated in portfolio/backend/database/ent/runtime.go
|
||||
|
||||
const (
|
||||
Version = "v0.13.0" // Version of ent codegen.
|
||||
@ -4,7 +4,7 @@ package ent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/team"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
@ -3,7 +3,7 @@
|
||||
package team
|
||||
|
||||
import (
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -6,9 +6,9 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"portfolio-backend/database/ent/project"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database/ent/project"
|
||||
"portfolio/backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
@ -4,8 +4,8 @@ package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/team"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -7,10 +7,10 @@ import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"math"
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio-backend/database/ent/project"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/project"
|
||||
"portfolio/backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -6,10 +6,10 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio-backend/database/ent/project"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/project"
|
||||
"portfolio/backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -4,7 +4,7 @@ package ent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database/ent/user"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
@ -3,7 +3,7 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -6,8 +6,8 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
@ -4,8 +4,8 @@ package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"math"
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -6,9 +6,9 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"portfolio-backend/database/ent/predicate"
|
||||
"portfolio-backend/database/ent/team"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database/ent/predicate"
|
||||
"portfolio/backend/database/ent/team"
|
||||
"portfolio/backend/database/ent/user"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"portfolio-backend/database"
|
||||
"portfolio-backend/database/ent"
|
||||
"portfolio-backend/database/ent/user"
|
||||
"portfolio/backend/database"
|
||||
"portfolio/backend/database/ent"
|
||||
"portfolio/backend/database/ent/user"
|
||||
)
|
||||
|
||||
func GetUser(ctx context.Context, id int) (*ent.User, error) {
|
||||
Loading…
x
Reference in New Issue
Block a user