go-siris / tech-and-ideas-talk

Our tech and ideas talk
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Discuss: Make SIRIS more Plugin Compatible. #3

Open Dexus opened 7 years ago

Dexus commented 7 years ago

As I like the Idea from @theodesp to make SIRIS more compatible for plugins. Split it to more small pieces.

So now my Idea is to make the Plugins with a fix Interface API, Register functions and priority for the call of that functions.

Example:

type (
    Register(hookname string, function func, priority int) 
)

For an better RL example we can look to https://github.com/go-siris/siris/pull/45/files#diff-a397a070e184e3d63fa3d834b18b8b93R195 Something like this would be nice and good for us to Register those events/functions.

Then we can include this Plugins like

import (
    _ "example.com/siris-plugin/sessions"
)

The Plugin is register it self for the correct hook where it needed.

Additional you can register own hooks, like you need a basicauth for a party-route.

What did you think about this?

Dexus commented 7 years ago

ping @theodesp, @Allendar, @Andersbiha, @godofdream, @go-siris/core

Allendar commented 7 years ago

I like the idea, but isn't a plugin (or hook) much lower level? BasicAuth mechanics sounds more like something that would be a Middleware, or would there be no distinction between those anymore?

Dexus commented 7 years ago

Yes of corse it's more low level. But you can then register plugins and make a config for each plugin, but we can also support the simple middelwares. With a plugin you can create something like micro services and other plugins. What ever you need:

Von meinem iPhone gesendet

Am 23.07.2017 um 17:30 schrieb Allendar notifications@github.com:

I like the idea, but isn't a plugin (or hook) much lower level? BasicAuth mechanics sounds more like something that would be a Middleware, or would there be no distinction between those anymore?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Allendar commented 7 years ago

What I notice most is that in many projects I don't use all the features of the framework at all. For some projects I don't need front-end, views or sockets at all. For others I only use sockets. Maybe kind of like the way the old contrib system worked, we strip core things from Siris and maybe provide some easy auto-install inclusion system so people can easily fetch one or more of our plugins that way? So say I want a blanco project I don't want it to load any extra dependencies. Then I can just add a View engine, a Session engine and a Websocket engine.

Dexus commented 7 years ago

Maybe i can create in the next week a prototype for it. That shows how i would do it.