psandeepunni / cowboy-automatic-route-dispatcher Goto Github PK
View Code? Open in Web Editor NEWErlang REST framework
License: MIT License
Erlang REST framework
License: MIT License
Write up modules that runs on all requests before/after the right controller is called. Sort of like a global pre/post hook.
The default or landing page (a.k.a domain root) is currently not possible to implement. By convention, an <application_name>_index.erl should respond to calls made to ' / '.
When there are some custom headers (like session-id) set in request, CORS policies does not allow access (on client side). The solution is to add cowboy_req:set_resp_header(<<"access-control-allow-headers">>, <<"*">>, ...)
alongside <<"access-control-allow-origin">>
in files cards_dealer.erl and cards_root_handler.erl
Provide configuration options for CARDS via environment variables. This incorporates future configurable modules such as a riak client.
We'll need to facilitate hooks for controllers (init/terminate alternatives) which are also to follow the naming convention style. Can be done in two ways: one is to have a hooks folder, with filenames corresponding to controllers and methods to actions. Another is to have *_controller.erl replaced by *_hooks.erl and actions as methods.
Differentiation of POST and PRE execution hooks should reside on the method naming. For an action "act_one" the POST and PRE execution hooks may look like: pre_act_one() -> and post_act_one() ->
Should have an additional parameter or way of transferring session data (viz. user login status).
Must be written in such a way that CARDS_DEALER provides a unified API for authentication with a database of choice. A session-id or an API-Token is validated, either against a stored session or passed to a user written module that decides the authentication method itself. Default(configuration free) session-id/API-Token based approach requires our own implementation of a micro OAuth protocol and a database for storage.
If using erlang.mk
Use
dep_cards = git https://github.com/psandeepunni/cowboy-automatic-route-dispatcher.git master
Instead of
dep_cards = https://github.com/psandeepunni/cowboy-automatic-route-dispatcher.git master
Websockets are not routed at the moment. Need to implement it.
Proposed scheme:
/handle/extension[/extras]
Relates to handle_socket:extension_init(), handle_socket:extension_info(), handle_socket:extension_receive(), handle_socket:extension_terminate() where init, info and terminate are optional.
NOTE: /handle/extension would respond to HTTP(S) via handle_controller:extension()
CowboyAutomaticRouteDispatcherService -> CARDS
By documentation, cards should have a fallback for absent policies. This fails in the current build and need to be addressed asap.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.