Commit Graph

56 Commits

Author SHA1 Message Date
Adrien Marquès b0e25b431c
ToHTTPServer now returns the exported field http.Handler instead of an unexported type 2020-04-04 10:39:02 +02:00
Adrien Marquès b1498e59c1
clarity rename: dynamic package to dynfunc 2020-04-04 10:36:52 +02:00
Adrien Marquès e1606273dd
remove useless func type 2020-04-04 10:10:24 +02:00
Adrien Marquès e7dd1e7a56
migrate handler from api to aicra; check for service when setting handler 2020-03-29 15:04:12 +02:00
Adrien Marquès af09466013
migrate api.response to const errors; make HandlerFn return an api.Error; rename http HandlFunc to Handle;
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2020-03-28 14:57:28 +01:00
Adrien Marquès eef94ff998
also check method when finding missing handlers 2020-03-22 16:37:43 +01:00
Adrien Marquès 2ee48560b6
make ToHTTPServer() check for missing handlers
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
- check for missing handlers in ToHTTPServer()
 - rename HTTP() to ToHTTPServer()
 - remove logs
2020-03-21 16:53:19 +01:00
Adrien Marquès d6c22b5ff0
adapt server to previous api changes
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-03-21 14:49:36 +01:00
Adrien Marquès 1225e3b1f2
refactor server handler, rename for readability 2020-03-08 16:26:56 +01:00
Adrien Marquès 6bc8160f99
Prettify logs 2020-03-08 16:26:55 +01:00
Adrien Marquès acfbee3894 add startup logs
Log aicra configuration 'METHOD /PATH' when creating the instance
Log mapped handlers before starting listening

To know when we start listening (was transparently handled by http.ListenAndServer) ; added a wrapper around 'Server' (i.e. httpServer) that fulfills the http.Server interface
2019-09-26 19:03:37 +02:00
Adrien Marquès eb5ce4c0d0 fix: semantic renaming : internal.config.Method.Permission is now Scope 2019-05-05 19:01:54 +02:00
Adrien Marquès 6afedf190f ref 1: clean server.go code + response implements http.Handler + add generic getter on request params Get() (interface{},error) 2019-05-05 19:01:54 +02:00
Adrien Marquès 0e498607ba clean 2019-05-05 19:01:54 +02:00
Adrien Marquès 7a87288876 fix: rename 'WrapError' to 'SetError' + shadow response error + response implements Error() 2019-05-05 19:01:54 +02:00
Adrien Marquès 1e4476ced5 feat: rename 'Error.Put' to 'SetArguments' with n >= 1 arguments + move 'WrapError' to response 2019-05-05 19:01:54 +02:00
Adrien Marquès b9ca1801bd fix: rename 'NewError' to 'WrapError' 2019-05-05 19:01:54 +02:00
Adrien Marquès b9f240b86b feat: fix error creation to bind arguments directly + add optional error argument in NewResponse() 2019-05-05 19:01:54 +02:00
Adrien Marquès d0f5277bf4 fix: prefix service path with '/' if missing 2019-05-01 16:28:16 +02:00
Adrien Marquès 16ea60f2aa fix: add data to 'ErrorUncallableMethod' and 'ErrorUncallableService' 2019-05-01 16:20:32 +02:00
Adrien Marquès 98ae854251 feat: add scope to request 2019-05-01 15:56:18 +02:00
Adrien Marquès cd2bcdd8bc ref 0: first working version ; totest 2019-05-01 15:14:49 +02:00
Adrien Marquès 7e66b6ddd5 ref 0: big refactor of concerns between api request, server, etc 2019-05-01 13:44:45 +02:00
Adrien Marquès a63e227538 ref 0: internal/request 2019-05-01 00:02:28 +02:00
Adrien Marquès 0eee615aea rename 'internal/api' to 'internal/apidef' (api definition) 2018-10-07 11:40:35 +02:00
Adrien Marquès 54d4b860de release req.Body when serving http 2018-10-02 17:14:44 +02:00
Adrien Marquès b1092437f9 refactor default type checkers | load default types if set in aicra.json (.build/DEFAULT_TYPES/*.so) 2018-10-02 11:10:21 +02:00
Adrien Marquès 85a0521723 rename err.BindArgument() to err.Put() 2018-10-01 21:21:27 +02:00
Adrien Marquès d406338777 implement driver for type checkers | move controller/middleware/checker definition inside the 'driver' package (all uses are exported from this place) | now driver.Driver returns 'Controller', 'Middleware', and 'Checker' in the interface | a lot a junk 2018-10-01 19:27:38 +02:00
Adrien Marquès 37fe30ebc7 rename 'internal/meta' to 'internal/config' | move driver type definition into explicit file + remove 'import' driver | remove useless method to parse multipart 2018-10-01 17:43:18 +02:00
Adrien Marquès 253a2b0b59 minfix in 'AICRA' command | plugins are now using the Export() method to return Controller/Middleware 2018-10-01 15:27:56 +02:00
Adrien Marquès 7bcbefdf35 rename 'internal/config' to 'internal/api' | rename 'internal.api.Load()' to 'internal.api.Parse()' 2018-10-01 14:15:00 +02:00
Adrien Marquès 9c9079f06b add 'driver.Driver.Name() string' and use it to select the default type/middleware folder (.build/middleware or middleware) | fix driver.Generic.LoadMiddleware() | remove variadic arguments for middleware.CreateRegistry() and checker.CreateRegistry() 2018-09-28 15:59:21 +02:00
Adrien Marquès 2cfc5a2ba0 update 'middleware' types | rename driver.Driver.Load() into RunController() | add driver.Driver.LoadMiddleware() | add driver management to middleware.Registry at creation | [TODO] implement diver.Generic.LoadMiddleware() 2018-09-28 10:54:13 +02:00
Adrien Marquès f5800900b0 rename 'internal/apirequest' to 'internal/request' but use import alias 'apirequest' in dependencies 2018-09-28 08:10:41 +02:00
Adrien Marquès fced676c42 add 'driver/generic' (to test, alpha version) 2018-09-27 14:11:48 +02:00
Adrien Marquès 3feae783dc add driver management + moved implementation of default driver into 'driver/plugin' 2018-09-27 13:43:36 +02:00
Adrien Marquès 5aef3f5572 server implements http.Handler (ServeHTTP(responseWrite, request)) | apirequest.BuildFromHTTPRequest() becomes apirequest.FromHTTP() | update readme 2018-07-11 19:02:33 +02:00
Adrien Marquès 05d5c23038 fix aicra.files.IsDir() which logic was inverted | make add() private for registries (checker + middleware) + fix server.go (invalid address for Server.controller because wasn't initialized to NIL) 2018-07-11 01:51:10 +02:00
Adrien Marquès 1aee9e92fd rename package 'request' -> 'apirequest' ; 'config' -> 'controller' + main types.go bundled into server.go + made attributes non-exported (lowercase) 2018-07-11 01:36:42 +02:00
Adrien Marquès 637bc91770 LINT: renaming + refactor 2018-07-09 01:34:21 +02:00
Adrien Marquès 6ebdd61325 LINT + Server.extractParameters is now private + add management for errors : 'UncallableController' and 'UncallableMethod' 2018-07-09 01:00:45 +02:00
Adrien Marquès 0bf5646eb7 remove setters for checker/middleware build folders 2018-07-09 00:32:19 +02:00
Adrien Marquès 07bbdbbe30 rename 'implement' into 'response' 2018-07-09 00:15:29 +02:00
Adrien Marquès 6784c2df95 moved local imports into 'internal' parent package 2018-07-09 00:10:03 +02:00
Adrien Marquès 94171ab6a9 remove debug + change 'custom-types' folder for custom types to 'types' 2018-07-07 23:37:12 +02:00
Adrien Marquès bb8cf07ab6 fix controller path + minmod 2018-07-07 23:15:54 +02:00
Adrien Marquès b39dff10eb add middleware (same principle as types) + scope check in progress 2018-07-07 22:10:56 +02:00
Adrien Marquès 8dc2de5e5d minmod 2018-07-07 19:24:02 +02:00
Adrien Marquès 5b86855f27 refactor 'routeRequest' 2018-07-07 19:21:00 +02:00