Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add enable #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add enable #101

wants to merge 1 commit into from

Conversation

t61j
Copy link

@t61j t61j commented Jun 4, 2020

@srghma
Copy link
Contributor

srghma commented Nov 6, 2020

I think it's better if we wont allow to use these methods: enable, disable, get without callback, set

but instead, make safe wrappers for the settings table variables http://expressjs.com/en/4x/api.html#app.settings.table

@srghma
Copy link
Contributor

srghma commented Apr 11, 2021

something like

BuiltinTable.Properties

case_sensitive_routing = "case sensitive routing"
env                    = "env"
etag                   = "etag"
jsonp_callback_name    = "jsonp callback name"
json_escape            = "json escape"
json_replacer          = "json replacer"
json_spaces            = "json spaces"
query_parser           = "query parser"
strict_routing         = "strict routing"
subdomain_offset       = "subdomain offset"
trust_proxy            = "trust proxy"
views                  = "views"
view_cache             = "view cache"
view_engine            = "view engine"
x_powered_by           = "x-powered-by"


BuiltinTable.Unsafe

foreign import _get :: Fn2 Application String (Effect Foreign)
foreign import _set :: Fn2 Application String Foreign (Effect Unit)
foreign import _enable :: Fn2 Application String (Effect Unit)
-- Boolean because https://github.com/expressjs/express/blob/508936853a6e311099c9985d4c11a4b1b8f6af07/lib/application.js#L421
foreign import _enabled :: Fn2 Application String (Effect Boolean)
foreign import _disable :: Fn2 Application String (Effect Unit)
foreign import _disabled :: Fn2 Application String (Effect Boolean)

BuiltinTable.Safe

set__case_sensitive_routing :: Boolean -> AppM Unit
get__case_sensitive_routing :: AppM Boolean

get__env :: AppM String
set__env :: ...

data Etag = Disabled | Enabled | Strong | Weak | Dynamic
get__etag ::

get__jsonp_callback_name :: AppM String
get__json_escape :: AppM Boolean
# set__json_replacer :: AppM
# get__json_spaces :: AppM ???
# get__query_parser :: AppM
# get__strict_routing :: AppM
# get__subdomain_offset :: AppM
# get__trust_proxy :: AppM
# get__views :: AppM
# get__view_cache :: AppM
# get__view_engine :: AppM
# get__x_powered_by :: AppM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants