- Bug Fix: In error.js set
signal.responded
tofalse
to allow custom error routes to use$.end()
- Bug Fix: In error.js check if
app.routes.error.length
is more than 0 to only iterate through custom error handlers if there are any. This allows passing the functionality to the default error handler page
- Introducing
app.host(location)
to allow handling hostnames and ports without creating a new server instance. It's useful when the hostname and port is changed by a proxy server. #73
- Bugfix for
$.download
when calling$.sendFile
send the proper encoding not the name. #67
- Introducing
$.download(path, filename)
#67 - Download Test
- Multipart Example
- Download Example
- Introducing the app.resource(path) class for grouping methods - inner functionality inspired by @luisvinicius167 's diet-group-router #32
- Introducing signal.setHeader(key, value) to set a response header #61
- Introducing signal.getHeader(key) to return a response header #61
- Introducing signal.getRequestHeader(key) to return a request header #61
- Introducing signal.error(key) to return an error with a key #61
- Introducing signal.sendFile(path) to end a response with a file #69
- Introducing
$.error('message') and $ .error('stack') to allow better Error Exceptions handling with app.error(callback) - Added example for signal.error
- Added example for signal.sendFile
- Replaced object.observe() with the new ES6 Proxy - Solves #42, #60, #72
- Only Support Node Version >= 6.4.0
- New MVC Test Suite
- Bug Fix: User decoreURIComponent on the signal.body
- New Example: Simple File Serving Example
- Upgrade
diet-qs
with the newquerystrings
module that fixes nested Query String to Array conversions. - New Utils Controller
- Moved isset() into the Util Controller
- Ports are now wildcards for every hostname. Listening on a Port (
app.listen(8000)
) will accept any Hostname request within that Port. Listening on a Hostname (app2.listen('http://test.com:8000/')
) within that Port will have priority.
Error.stack
not always present on Error in controllers/router.js by @demariusinitialized
is not constant in index.js (es6, strict mode fix)- Replaced Native Object.observe with
object.observe
module to support observe in Node >= v6.0.0
- Check if path contains query in Signal#redirect by @demarius
- Check if path contains query in Signal#redirect. Thanks @demarius
Stashed changes
- AB Load Testing Comparison between Vanilla Node, Diet.js and Express.js
- add second argument
isLast
to $.end(yourData, isLast), $.json(yourData, isLast), $.success(yourData, isLast) and $.failure(yourData, isLast). SettingisLast
to true will stop the execution of the middleware chain completely
// usage
$.end('hello world', true)
- Check existence of app.routes and routes in hosts.js and iterator.js
- Drop support for Node versions below v4.2.4
- Middleware renamed to Controller
- Introducing ES6 Generator Controllers (
yield
and*
) - Introducing
app.controller
function method registering- can be called as a normal function
- creates a thunk around the controller for generators when called with yield
- Introducing
app.protocol(name, handler)
- Introducing Server Event Handlers
server.on(event, handler)
server.off(event, handler)
server.one(event, handler)
server.onAll(event, handler)
server.many(event, handler)
server.emit(event, handler)
- Introducing App Event Handlers
app.on(event, handler)
app.off(event, handler)
app.one(event, handler)
app.onAll(event, handler)
app.many(event, handler)
app.emit(event, handler)
- Introducing Server Events
- init
- create (new app)
- Introducing App Events
- listen
- route.attach
- route.start
- route.end
- route.controller.attach
- route.controller.start
- route.controller.iterate
- route.controller.end
- route.error
- protocol.attach
- Add Examples for:
- Events
- Generators
- Introducing
app.model()
- Introducing
app.view()
- Introducing
app.controller()
- Added support for
yo
(generator-diet) - Support for node 4.2.4, 5.3.0
- Body/footer separation in host.js for clarity
- Don't JSON stringify
$.failure()
and$.success()
responses because$.end()
does it too
- Fixed a https bug in host.js - if the port was undefined in the header it used 80. For https it should be 443. Now it's using the server's configuration to choose a default fallback protocol.
- Chainable Server Instance Creation, Listening and Routing. Now you can do stuff like:
server()
.listen(8000)
.get('/', function($){ $.end('hello world'); })
.get('/other', function($){ $.end('hello other world') });
.missing(function($){ $.end('404 :)') });
- Fixed bugs with
$.end
-
$.end()
now serves JSON responses on requests where the"x-requested-with"
=="XMLHttpRequest"
or the"Authorization"
header is set and contains"Bearer"
or"Token"
in it's value -
$.end()
now accepts JSON objects as a value and sends it as a JSON response - app.html now enables
$.html as the default response when using $ .end - Added
$.html()
- by default it just sets the content-header to html - to ovewrite it set a handler for$.htmlModule (input)
in your diet header modules - Bug Fixes
- Added Unit Tests for the new
$.end()
function
- Fixed a bug that didn't allow registering named addresses without a port
- Fixed a bug in server options that caused to display the diet header for every server instance
- A server instance now has an options attribute
server(options)
- Added
options.silent
to server options which if set totrue
disables all logs generated by diet for that Server Instance
- Treat localhost addresses equally (127.0.0.1, 192.168.99.100, localhost)
- Listen on multiple addresses without redirects or host configs
- The body for POST and PUT methods now require the appropriate "Content-Type" header to be parsed. For URL encoded body "application/x-www-form-urlencoded" is required, for JSON requests "application/json". If no "Content-Type" is specified then $.body contains the raw body content.
- Support for
options
,put
,head
,patch
,trace
anddelete
HTTP methods - Added
app.put
- Added
app.head
- Added
app.patch
- Added
app.delete
- Added
app.trace
- Added
app.options
- Fixed body parsing mechanism. Every route's body is parsed that has a Content-Type or Transfer-Encoding Header. According to rfc2616-sec4
- 100% Unit Test Coverage
- Build coverage with TravisCI
- Fixed a bug that didn't allow to create https server with other ports than 80
- Completely rewritten source code
- New website with better documentation
- Dropped the
plugin system
- Introduced
middleware
- Introduced
app.error
for error handling - Introduced
app.missing
for not found pages - Introduced
app.header
for global middleware at the beginning of routes - Introduced
app.footer
for global middleware at the end of routes app.failure
replacedapp.error
- Changed app.error to record errors instead of ending the response
- Fixed many bugs
- Fixed a bug that caused starting an HTTPS server in failure with port 80
- Better Docs
- support for safe asynchronous error handling. replaced try catch with domains
- setting
signal.passed
to false also stops the plugin chain just assignal.data.passed
- fixed a bug in the chain. when
signal.data.passed
isfalse
and$.end()
is called the chain stops and other listeners on the same route will not be called. - calling
$.error()
from now on sets$.passed
tofalse
- updated
readme
- added
app.server
- cleaned up unnecessary
console.logs
- Unit Test Coverage 100%
- Deprecated
new App
nowrequire('diet')
returns a server object - Replaced the
querystring
module with the newdiet-qs
- Added new signal method
$.send
to appending to the response message - Added new signal method
$.chain
to allow adding plugins to the plugin chain on the fly. - Added chainable commands like
require('diet').server().start().get('/')
- Changed the Plugin framework
- Removed
module.exports.onload
listener - Added
module.parent.return()
instead - Added
module.parent.options
to access the plugin options - Added
module.parent.app
to access the calling application
- Removed
- Extended documentation
- Added
examples
- Fixed every known bug
- Started Unit Testing
- Fixed several bugs
- Better documentation
- Extended the
Signal $
- Changed
new Domain
tonew App
- Extended the
Signal $
- Fixed several bugs
- Better documentation
- Rewrote diet completely from the ground up
- Introducing
Plugins
- Introducing the
new Domain
function - Introducing the
Signal $
- Introducing Sinatra like
Router
- MIT Licensed
- Separated the code into several modules
- Upload into diet-upload
- Cookies into diet-cookies
- Accounts into diet-accounts
- Request into diet-request
- Comet into diet-comet
- Dictionary into diet-dictionary
- tasks into diet-tasks
- MySQL into diet-mysql
- Use into diet-use
- Next into nextjs
- Fixed Several Bugs
- Fixed several bugs
- app.dictionary introduced
- response.head introduced
- response.html now includes arguments from response.head as a default
- stand alone dictionary module
- Improved html/form module with inside labels
- comet.onExit introduced
- cheerio introduced for html manipulation
- Cross file locals introduced inside the
html
module - Echo is now not part of the
html
module - Introduced app.notFound for 404 error routing
- Introduced auto app.www
- Introduced app.denie_requests
- Introduced app.domain_redirect
- public folder now can have any name because .html is no longer requires "/public" as the public folder's name instead uses the custom one specified in app.options.public
- MySQL data mapping
- MySQL is now based on the mysql.js javascript module
- MySQL API drastically changed
- Better form handling logic with
check
module - Improved overall stability
- Added subdomain support with app.subdomain()
- Better cookie set
- Extension Apps with app.extend(); for a site which requires additional embeddable systems to improve it's customer experience, for example a forum, feedback or blog system
- Very Simple Image Processing API with ImageMagick
- Easy HTTP/HTTPS server creation
- Advanced Route Handling
- With Manual URL handling (ex: /home, /about, /work)
- With Dynamic URL Handling (ex: /posts/9874, /user/john)
- Static File Handler
- Advanced HTML with Node Module
- With automatic .html to html with node integration
- With Object Logger
- With Advanced Error Tracking
- Included Mysql Manager
- Included Cookie Manager
- Included HTML Upload Module
- Included Async Module
- Included Extension Modules ex: isset()
- Stand alone HTTP Router - dropped expressjs
- Stand alone HTML Parser - dropped jade
- mysql support for express
- based on express and jade