Changelog
1.0.0
NODE_ENV
environment variable and sets its mode accordingly
NODE_ENV
is undefined, citizen defaults to production modeNODE_ENV
access.log
, error.log
, and debug.log
and can be enabled independently
400
) and server (500
) error logs can be enabled/disabled independentlyAccept
header to determine the response format
text/html
, text/plain
, application/json
, and application/javascript
(JSON-P)app.log()
will attempt to create the logs directory if it doesn't already existcapture
(default) will write the error to the log, render an error view to the client, and keep the process/server runningexit
will send a 500 to the client without rendering a view, write the error to the log, throw the error, then exit the processx-citizen-uri
header for routing behind proxy servers is deprecated in favor of industry standard Forwarded
headers
X-Forwarded
header support has been deprecated and will be removed from future versionstype
, ajax
, show
, and task
) have been released for dev useapp.cache.set()
now automatically expires/clears the specified cache key if it already exists and creates a new cache item rather than throwing an errorusePolling
for networked file systems, for example)next
directive (previously handoff
) now accepts a route pathname similar to the include route pathname, which allows simulating a different route when handing off to the next controller in the chainconfig.citizen.templateEngine
with the package namehandoff
directive has been renamed to next
route
property has been removed from the include
directive
action
(formerly controller
) and request
(formerly route
)request
only applies if the controller action in which it's called is the action specified in the original request; subsequent controllers in the chain can no longer prompt a request cache/type/direct
URL parameter used to bypass controller handoff has been replaced with /direct/true
/direct/true
URL parameter is no longer required to bypass the controller chain
_
) at the beginning of the controller file name, and when requested from the client it will be rendered directly/direct/true
is still available to force controllers to bypass the chainrequest.start()
event now fires before checking if the controller exists
request.start()
(i.e., it fires at the start of the request)request.start()
even if the requested controller doesn't exist (custom 404 handling, for example)request.start()
context won't inherit the controller config like it did previously, so if you depend on anything in your controller config within the request.start()
event, that functionality should be moved to the controller action itself, which fires after request.start()
enable
property in the config have been renamed to enabled
sessions
configuration setting is now an object that takes two arguments:
enabled
(boolean)lifespan
(integer) - Reflects session timeout in minutes and replaces the old sessionTimeout
property, which has been removedform
configuration setting has been renamed to forms
log
configuration setting has been renamed to logs
urlPaths
configuration option has been removed
content
directive, which contains all data local to the controller/view, has been renamed to local
legalFormat
config option is now contentTypes
contentTypes
is an array that lists available output MIME types ("text/html", "text/plain", "application/json", "application/javascript")legalFormat
directive has been removed
contentTypes
option for setting available formats within a controller/actionformat
URL parameter (/format/json, etc.) has been removed
Accept
request header to the desired content type (currently supported: text/html
, text/plain
, application/json
, application/javascript
)params.route
no longer contains the view, but it was wrong half the time anyway
params.route.chain
for all controllers in the chain, including their actions, views, and contextparams.route.parsed.path
is now params.route.parsed.pathname
or params.route.pathname
output
URL parameter for JSON requests has been removed
output
include accessing controllers directly (underscore naming convention or /direct/true
) and better API design in the first placectzn_debug
URL parameter is now a boolean that enables debug output in the view
ctzn_inspect
URL parameter to specify the variable you want to dump to the viewfallbackController
option has been removed because there are better ways to handle a nonexistent controller in the app itself (citizen now returns a 404 by default)Changelog
0.9.1
Changelog
0.9.0
New features:
async-await support in controller actions
Hot module reloading for controllers and models in development mode
BREAKING CHANGES (see readme for details)
Controller actions are now called as async functions, so you should use async-await syntax
Thanks to the above, the manual passing of event emitters to return results and errors is no longer supported and has been removed (simple return and throw statements do the job now). This is a major breaking change that will require you to rewrite all your controllers and any function calls to which you pass the emitter. While this could be a massive headache depending on the size of your app, it's unquestionably an improvement, with simpler syntax and no clunky emitter handling.
All helpers deprecated in 0.8.0 have been removed
The syntax for the formats directive has been simplified and it has been renamed to "legalFormat" to distinguish it from the format url parameter
The urlDelimiter option has been removed from JSON output (the delimiter is now a comma, because if you use a comma in a JSON key, you're insane)
The headers directive has been renamed to "header", keeping the grammar consistent with other directives (cookie, session, etc.)
Form configuration now has both a global config (set within your config file) and controller-action config (a new config
object set within the controller module exports); syntax has changed from the previous global setting and maxFieldSize is now specified in kilobytes rather than megabytes
CORS controller settings are under the new config
module export
Functionality previously under the debug mode has been moved to development mode and debug has been removed
Log configuration has been streamlined and consolidated, with some log settings previously under the debug settings now moved to logs
Invalid URL parameters in controller and route caches now always throw an error, but don't prevent rendering
The directory for app event handlers has been renamed from "/on" to "/hooks".
Changelog
0.8.7
Changelog
0.8.6
Changelog
0.8.5
Changelog
0.8.4