samirettali / tor-spider

A spider for Hidden Services
4 stars 0 forks source link

[Feature] fast and easy admin panel #3

Open ghost opened 4 years ago

ghost commented 4 years ago

Hi again,

Hope you are all well again :-) !

I wanted to suggest to create a backend with qor/admin to tor-spider:

for eg, to create an admin UI, you just have to write.

package main

import (
  "fmt"
  "net/http"
  "github.com/jinzhu/gorm"
  _ "github.com/mattn/go-sqlite3"
  "github.com/qor/admin"
)

// Create a GORM-backend model
type User struct {
  gorm.Model
  Name string
}

// Create another GORM-backend model
type Product struct {
  gorm.Model
  Name        string
  Description string
}

func main() {
  DB, _ := gorm.Open("sqlite3", "demo.db")
  DB.AutoMigrate(&User{}, &Product{})

  // Initialize
  Admin := admin.New(&admin.AdminConfig{DB: DB})

  // Allow to use Admin to manage User, Product
  Admin.AddResource(&User{})
  Admin.AddResource(&Product{})

  // initalize an HTTP request multiplexer
  mux := http.NewServeMux()

  // Mount admin interface to mux
  Admin.MountTo("/admin", mux)

  fmt.Println("Listening on: 9000")
  http.ListenAndServe(":9000", mux)
}

If you want I can do it and make a PR.

What do you think ?

Cheers, X

samirettali commented 4 years ago

That would be great. In fact, I wanted to implement a panel with these functionalities:

ghost commented 4 years ago

For querying the result, I have this suggestion:

And to write it in Vue.js so It gonna be easy to add more features to backend.

Refs.