33 Commits

Author SHA1 Message Date
Remy Sharp
7959680227 fixed up the CORS support for the API 2013-06-12 11:03:18 +01:00
Remy Sharp
b537de0854 Finishing up API, to allow for read only
- Added allowReadOnly in config - defaults to true
- read only has CORS support
- Add handler for :rev route, and autoload the latest (needs more cleaning up)
- Allow xhr requests to both /api/x and /abcd/123 (how it originally worked)
2013-06-11 12:41:00 +01:00
Matthew O'Riordan
44d030e88a Flag to enforce API requests over SSL 2013-05-20 07:33:26 +02:00
Matthew O'Riordan
a234941cf3 API can require an API key for a user (disallow anonymous) 2013-05-20 07:18:57 +02:00
Matthew O'Riordan
52fa78aa31 API middleware adding req.isApi 2013-05-19 16:36:03 +02:00
Matthew O'Riordan
364dec1b25 Modify middleware to bypass CSRF for exact or regex matches 2013-05-19 14:16:48 +02:00
Aron Carroll
7274bab3dc Only parse the upload limit option once 2012-10-27 18:40:00 +01:00
Aron Carroll
2caed53c1c Improve API for setting max request limit
Renamed the key to "max-request-size" and allow units to be provided
rather than just a number. The default is now 1MB.
2012-10-27 18:11:52 +01:00
Aron Carroll
48e51ba19b Add middleware for catching large posts
This will return an error response that isn't currently picked up by
the JS Bin front end, but it does stop MySQL throwing exceptions. It
can be turned off by setting the "bin max-size" to 0 or null.
2012-10-11 19:48:53 +02:00
Aron Carroll
547724b3b4 Improve subdomain handling. Fixes #348
We now detect subdomains by taking anything before the "url host"
option rather than assuming the host will always be x.y.

So if the host is "localhost:3000" then "subdomain" will be
extracted for requests to "subdomain.localhost:3000".
2012-09-26 18:35:37 +01:00
Remy Sharp
e497310909 Reduce allowed headers 2012-08-16 00:23:24 +01:00
Remy Sharp
85f1ce7d18 Added a reload event to the stream, and supporting CORS
(for a secret project)
2012-08-15 23:40:24 +01:00
Aron Carroll
2930ba2192 Fix support for custom subdomains 2012-08-14 20:05:23 +01:00
Remy Sharp
9b5606332a Make sure the csrf method is *always* called when GET, HEAD or OPTION. Fixes #303
Because it's in there that the csrf token is set, regardless of whether
it's checked.
2012-08-13 20:35:32 +01:00
Remy Sharp
824a174862 updated csrf to support custom ignored routes 2012-08-10 13:06:51 +01:00
Aron Carroll
d9c2cd4a83 Lint the node source 2012-08-03 13:04:48 +01:00
Remy Sharp
8e12566650 Error handling 2012-07-23 01:05:56 +01:00
Remy Sharp
0626d6adb9 @aron please read: this dynamically changes the host from jsbin.com to 3.jsbin.com - seriously freaked me out! 2012-07-23 01:03:58 +01:00
Aron Carroll
106e25650c Add a very simple flash message middleware 2012-07-06 16:58:17 +01:00
Aron Carroll
cbc89eeb1c Remove unneeded code from app and middleware 2012-06-30 11:12:47 +01:00
Aron Carroll
4202c5eac2 Move helpers into a separate file 2012-06-30 10:36:18 +01:00
Remy Sharp
f0624339e1 Pushing in @aron's changes from #190 2012-06-27 16:20:15 +01:00
Aron Carroll
164b56531c Merge branch 'feature/node' into 'feature/spike'
Conflicts:
	lib/app.js
	lib/handlers.js
	package.json
2012-06-10 12:24:02 +01:00
Aron Carroll
87a99bb670 Make helpers.getUrlForBin() always return a valid url 2012-06-03 22:45:09 +01:00
Aron Carroll
6f16cfa3ac Detect sub-domains and update relevant url settings 2012-05-26 19:14:58 +01:00
Remy Sharp
77fe7e7d7e Fixed path issues - fixes saving from changed urls, template restore, etc.
Basically, the ballache.
2012-05-25 17:03:26 +01:00
Aron Carroll
bee06c526e Add the .ajax flag to the Response object as well as Request 2012-05-20 21:45:17 +01:00
Aron Carroll
f25efb4455 Fix issue in helpers.production
Now correctly check the app.PRODUCTION rather than "this" which will be
undefined.
2012-05-20 21:43:58 +01:00
Aron Carroll
96353b35bc Add CORS support for cross origin GET requests 2012-05-18 16:55:34 +01:00
Aron Carroll
ddebd2307f Initial work on the server side spike code
Needs a massive code refactor in the near future though :)
2012-05-04 16:32:39 +01:00
Aron Carroll
a563f2d274 Update app.js to handle path prefix
This essentially mounts the application as middleware within another
connect server under the specified prefix. This means that when
redirecting that helpers.url() must be used to get the full path and
req.path will be missing the prefix.
2012-05-01 00:15:44 +01:00
Aron Carroll
fe5eae899c Move state onto Request instances via helper middleware
This seems a little hairy but essentially avoids creating modules
with factory functions which seems very clunky. We now provide various
helper functions that are bound to the application state such as
url, routing and models via the request object. This is massively
overloading this object but seems to be the common way in Express
apps to pass state into handlers.
2012-04-30 23:20:03 +01:00
Aron Carroll
e35adaa7cc Add middleware module for common middleware
(Need to work on my messages)
2012-04-20 15:03:03 +01:00