mora icon indicating copy to clipboard operation
mora copied to clipboard

Wondering about hooks

Open rwxrob opened this issue 9 years ago • 1 comments

Been playing around with this and realized it almost meets the needs I have except for I want to be able to do some GPG application-level field encryption on the server side before any PUT or POST would make it actually into the DB. Of course this would be over HTTPs as well and hadn't read of support for that as well.

But my main question is really related to being able to do 99% CRUD with mora and then 1% application specific data transformations, log triggers and the like with some sort of hook. I suppose I could just customize mora to my needs, but was wondering if any thought had already been given into providing such hooks into the pipeline.

rwxrob avatar May 31 '15 18:05 rwxrob

Mora is organized such that it can be embedded in your own application. In the root you find one main.go file that imports and wires-up all to start the application. It is also the right place to start a TLS server instead (I am now thinking about making this configurable)

Mora uses the go-restful package for mapping Http requests to Go functions. One of its features is the implementation of request and response filters. Filters allow you to add behavior/change data before and after handling the request by a function. Using a filter function, you could read the request body, encrypt it and put back that result in the same request for further processing.

emicklei avatar May 31 '15 19:05 emicklei