mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 02:42:48 +00:00
updated bunch of file paths and changed the way posts are loaded
This commit is contained in:
107
node_modules/method-override/HISTORY.md
generated
vendored
Normal file
107
node_modules/method-override/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
2.3.5 / 2015-07-31
|
||||
==================
|
||||
|
||||
* perf: enable strict mode
|
||||
|
||||
2.3.4 / 2015-07-14
|
||||
==================
|
||||
|
||||
* deps: vary@~1.0.1
|
||||
|
||||
2.3.3 / 2015-05-12
|
||||
==================
|
||||
|
||||
* deps: debug@~2.2.0
|
||||
- deps: ms@0.7.1
|
||||
|
||||
2.3.2 / 2015-03-14
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.3
|
||||
- Fix high intensity foreground color for bold
|
||||
- deps: ms@0.7.0
|
||||
|
||||
2.3.1 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.1
|
||||
* deps: methods@~1.1.1
|
||||
|
||||
2.3.0 / 2014-10-16
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.0
|
||||
- Implement `DEBUG_FD` env variable support
|
||||
|
||||
2.2.0 / 2014-09-02
|
||||
==================
|
||||
|
||||
* deps: debug@~2.0.0
|
||||
|
||||
2.1.3 / 2014-08-10
|
||||
==================
|
||||
|
||||
* deps: parseurl@~1.3.0
|
||||
* deps: vary@~1.0.0
|
||||
|
||||
2.1.2 / 2014-07-22
|
||||
==================
|
||||
|
||||
* deps: debug@1.0.4
|
||||
* deps: parseurl@~1.2.0
|
||||
- Cache URLs based on original value
|
||||
- Remove no-longer-needed URL mis-parse work-around
|
||||
- Simplify the "fast-path" `RegExp`
|
||||
|
||||
2.1.1 / 2014-07-11
|
||||
==================
|
||||
|
||||
* deps: debug@1.0.3
|
||||
- Add support for multiple wildcards in namespaces
|
||||
|
||||
2.1.0 / 2014-07-08
|
||||
==================
|
||||
|
||||
* add simple debug output
|
||||
* deps: methods@1.1.0
|
||||
- add `CONNECT`
|
||||
* deps: parseurl@~1.1.3
|
||||
- faster parsing of href-only URLs
|
||||
|
||||
2.0.2 / 2014-06-05
|
||||
==================
|
||||
|
||||
* use vary module for better `Vary` behavior
|
||||
|
||||
2.0.1 / 2014-06-02
|
||||
==================
|
||||
|
||||
* deps: methods@1.0.1
|
||||
|
||||
2.0.0 / 2014-06-01
|
||||
==================
|
||||
|
||||
* Default behavior only checks `X-HTTP-Method-Override` header
|
||||
* New interface, less magic
|
||||
- Can specify what header to look for override in, if wanted
|
||||
- Can specify custom function to get method from request
|
||||
* Only `POST` requests are examined by default
|
||||
* Remove `req.body` support for more standard query param support
|
||||
- Use custom `getter` function if `req.body` support is needed
|
||||
* Set `Vary` header when using built-in header checking
|
||||
|
||||
1.0.2 / 2014-05-22
|
||||
==================
|
||||
|
||||
* Handle `req.body` key referencing array or object
|
||||
* Handle multiple HTTP headers
|
||||
|
||||
1.0.1 / 2014-05-17
|
||||
==================
|
||||
|
||||
* deps: pin dependency versions
|
||||
|
||||
1.0.0 / 2014-03-03
|
||||
==================
|
||||
|
||||
* Genesis from `connect`
|
||||
23
node_modules/method-override/LICENSE
generated
vendored
Normal file
23
node_modules/method-override/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2014 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
173
node_modules/method-override/README.md
generated
vendored
Normal file
173
node_modules/method-override/README.md
generated
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
# method-override
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
[![Gratipay][gratipay-image]][gratipay-url]
|
||||
|
||||
Lets you use HTTP verbs such as PUT or DELETE in places where the client doesn't support it.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install method-override
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
**NOTE** It is very important that this module is used **before** any module that
|
||||
needs to know the method of the request (for example, it _must_ be used prior to
|
||||
the `csurf` module).
|
||||
|
||||
### methodOverride(getter, options)
|
||||
|
||||
Create a new middleware function to override the `req.method` property with a new
|
||||
value. This value will be pulled from the provided `getter`.
|
||||
|
||||
- `getter` - The getter to use to look up the overridden request method for the request. (default: `X-HTTP-Method-Override`)
|
||||
- `options.methods` - The allowed methods the original request must be in to check for a method override value. (default: `['POST']`)
|
||||
|
||||
If the found method is supported by node.js core, then `req.method` will be set to
|
||||
this value, as if it has originally been that value. The previous `req.method`
|
||||
value will be stored in `req.originalMethod`.
|
||||
|
||||
#### getter
|
||||
|
||||
This is the method of getting the override value from the request. If a function is provided,
|
||||
the `req` is passed as the first argument, the `res` as the second argument and the method is
|
||||
expected to be returned. If a string is provided, the string is used to look up the method
|
||||
with the following rules:
|
||||
|
||||
- If the string starts with `X-`, then it is treated as the name of a header and that header
|
||||
is used for the method override. If the request contains the same header multiple times, the
|
||||
first occurrence is used.
|
||||
- All other strings are treated as a key in the URL query string.
|
||||
|
||||
#### options.methods
|
||||
|
||||
This allows the specification of what methods(s) the request *MUST* be in in order to check for
|
||||
the method override value. This defaults to only `POST` methods, which is the only method the
|
||||
override should arrive in. More methods may be specified here, but it may introduce security
|
||||
issues and cause weird behavior when requests travel through caches. This value is an array
|
||||
of methods in upper-case. `null` can be specified to allow all methods.
|
||||
|
||||
## Examples
|
||||
|
||||
### override using a header
|
||||
|
||||
To use a header to override the method, specify the header name
|
||||
as a string argument to the `methodOverride` function. To then make
|
||||
the call, send a `POST` request to a URL with the overridden method
|
||||
as the value of that header. This method of using a header would
|
||||
typically be used in conjunction with `XMLHttpRequest` on implementations
|
||||
that do not support the method you are trying to use.
|
||||
|
||||
```js
|
||||
var connect = require('connect')
|
||||
var methodOverride = require('method-override')
|
||||
|
||||
// override with the X-HTTP-Method-Override header in the request
|
||||
app.use(methodOverride('X-HTTP-Method-Override'))
|
||||
```
|
||||
|
||||
Example call with header override using `XMLHttpRequest`:
|
||||
|
||||
```js
|
||||
var xhr = new XMLHttpRequest()
|
||||
xhr.onload = onload
|
||||
xhr.open('post', '/resource', true)
|
||||
xhr.setRequestHeader('X-HTTP-Method-Override', 'DELETE')
|
||||
xhr.send()
|
||||
|
||||
function onload() {
|
||||
alert('got response: ' + this.responseText)
|
||||
}
|
||||
```
|
||||
|
||||
### override using a query value
|
||||
|
||||
To use a query string value to override the method, specify the query
|
||||
string key as a string argument to the `methodOverride` function. To
|
||||
then make the call, send a `POST` request to a URL with the overridden
|
||||
method as the value of that query string key. This method of using a
|
||||
query value would typically be used in conjunction with plain HTML
|
||||
`<form>` elements when trying to support legacy browsers but still use
|
||||
newer methods.
|
||||
|
||||
```js
|
||||
var connect = require('connect')
|
||||
var methodOverride = require('method-override')
|
||||
|
||||
// override with POST having ?_method=DELETE
|
||||
app.use(methodOverride('_method'))
|
||||
```
|
||||
|
||||
Example call with query override using HTML `<form>`:
|
||||
|
||||
```html
|
||||
<form method="POST" action="/resource?_method=DELETE">
|
||||
<button type="submit">Delete resource</button>
|
||||
</form>
|
||||
```
|
||||
|
||||
### multiple format support
|
||||
|
||||
```js
|
||||
var connect = require('connect')
|
||||
var methodOverride = require('method-override')
|
||||
|
||||
// override with different headers; last one takes precedence
|
||||
app.use(methodOverride('X-HTTP-Method')) // Microsoft
|
||||
app.use(methodOverride('X-HTTP-Method-Override')) // Google/GData
|
||||
app.use(methodOverride('X-Method-Override')) // IBM
|
||||
```
|
||||
|
||||
### custom logic
|
||||
|
||||
You can implement any kind of custom logic with a function for the `getter`. The following
|
||||
implements the logic for looking in `req.body` that was in `method-override@1`:
|
||||
|
||||
```js
|
||||
var bodyParser = require('body-parser')
|
||||
var connect = require('connect')
|
||||
var methodOverride = require('method-override')
|
||||
|
||||
// NOTE: when using req.body, you must fully parse the request body
|
||||
// before you call methodOverride() in your middleware stack,
|
||||
// otherwise req.body will not be populated.
|
||||
app.use(bodyParser.urlencoded())
|
||||
app.use(methodOverride(function(req, res){
|
||||
if (req.body && typeof req.body === 'object' && '_method' in req.body) {
|
||||
// look in urlencoded POST bodies and delete it
|
||||
var method = req.body._method
|
||||
delete req.body._method
|
||||
return method
|
||||
}
|
||||
}))
|
||||
```
|
||||
|
||||
Example call with query override using HTML `<form>`:
|
||||
|
||||
```html
|
||||
<!-- enctype must be set to the type you will parse before methodOverride() -->
|
||||
<form method="POST" action="/resource" enctype="application/x-www-form-urlencoded">
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<button type="submit">Delete resource</button>
|
||||
</form>
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/method-override.svg
|
||||
[npm-url]: https://npmjs.org/package/method-override
|
||||
[travis-image]: https://img.shields.io/travis/expressjs/method-override/master.svg
|
||||
[travis-url]: https://travis-ci.org/expressjs/method-override
|
||||
[coveralls-image]: https://img.shields.io/coveralls/expressjs/method-override/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/expressjs/method-override?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/method-override.svg
|
||||
[downloads-url]: https://npmjs.org/package/method-override
|
||||
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
|
||||
[gratipay-url]: https://www.gratipay.com/dougwilson/
|
||||
132
node_modules/method-override/index.js
generated
vendored
Normal file
132
node_modules/method-override/index.js
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
/*!
|
||||
* method-override
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2014 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var debug = require('debug')('method-override')
|
||||
var methods = require('methods');
|
||||
var parseurl = require('parseurl');
|
||||
var querystring = require('querystring');
|
||||
var vary = require('vary');
|
||||
|
||||
/**
|
||||
* Method Override:
|
||||
*
|
||||
* Provides faux HTTP method support.
|
||||
*
|
||||
* Pass an optional `getter` to use when checking for
|
||||
* a method override.
|
||||
*
|
||||
* A string is converted to a getter that will look for
|
||||
* the method in `req.body[getter]` and a function will be
|
||||
* called with `req` and expects the method to be returned.
|
||||
* If the string starts with `X-` then it will look in
|
||||
* `req.headers[getter]` instead.
|
||||
*
|
||||
* The original method is available via `req.originalMethod`.
|
||||
*
|
||||
* @param {string|function} [getter=X-HTTP-Method-Override]
|
||||
* @param {object} [options]
|
||||
* @return {function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function methodOverride(getter, options){
|
||||
options = options || {}
|
||||
|
||||
// get the getter fn
|
||||
var get = typeof getter === 'function'
|
||||
? getter
|
||||
: createGetter(getter || 'X-HTTP-Method-Override')
|
||||
|
||||
// get allowed request methods to examine
|
||||
var methods = options.methods === undefined
|
||||
? ['POST']
|
||||
: options.methods
|
||||
|
||||
return function methodOverride(req, res, next) {
|
||||
var method
|
||||
var val
|
||||
|
||||
req.originalMethod = req.originalMethod || req.method
|
||||
|
||||
// validate request is an allowed method
|
||||
if (methods && methods.indexOf(req.originalMethod) === -1) {
|
||||
return next()
|
||||
}
|
||||
|
||||
val = get(req, res)
|
||||
method = Array.isArray(val)
|
||||
? val[0]
|
||||
: val
|
||||
|
||||
// replace
|
||||
if (method !== undefined && supports(method)) {
|
||||
req.method = method.toUpperCase()
|
||||
debug('override %s as %s', req.originalMethod, req.method)
|
||||
}
|
||||
|
||||
next()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a getter for the given string.
|
||||
*/
|
||||
|
||||
function createGetter(str) {
|
||||
if (str.substr(0, 2).toUpperCase() === 'X-') {
|
||||
// header getter
|
||||
return createHeaderGetter(str)
|
||||
}
|
||||
|
||||
return createQueryGetter(str)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a getter for the given query key name.
|
||||
*/
|
||||
|
||||
function createQueryGetter(key) {
|
||||
return function(req, res) {
|
||||
var url = parseurl(req)
|
||||
var query = querystring.parse(url.query || '')
|
||||
return query[key]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a getter for the given header name.
|
||||
*/
|
||||
|
||||
function createHeaderGetter(str) {
|
||||
var header = str.toLowerCase()
|
||||
|
||||
return function(req, res) {
|
||||
// set appropriate Vary header
|
||||
vary(res, str)
|
||||
|
||||
// multiple headers get joined with comma by node.js core
|
||||
return (req.headers[header] || '').split(/ *, */)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if node supports `method`.
|
||||
*/
|
||||
|
||||
function supports(method) {
|
||||
return method
|
||||
&& typeof method === 'string'
|
||||
&& methods.indexOf(method.toLowerCase()) !== -1
|
||||
}
|
||||
116
node_modules/method-override/package.json
generated
vendored
Normal file
116
node_modules/method-override/package.json
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"method-override@2.3.5",
|
||||
"/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/mongo-express"
|
||||
]
|
||||
],
|
||||
"_from": "method-override@2.3.5",
|
||||
"_id": "method-override@2.3.5",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/method-override",
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "method-override",
|
||||
"raw": "method-override@2.3.5",
|
||||
"rawSpec": "2.3.5",
|
||||
"scope": null,
|
||||
"spec": "2.3.5",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mongo-express"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/method-override/-/method-override-2.3.5.tgz",
|
||||
"_shasum": "2cd5cdbff00c3673d7ae345119a812a5d95b8c8e",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "method-override@2.3.5",
|
||||
"_where": "/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/mongo-express",
|
||||
"bugs": {
|
||||
"url": "https://github.com/expressjs/method-override/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"debug": "~2.2.0",
|
||||
"methods": "~1.1.1",
|
||||
"parseurl": "~1.3.0",
|
||||
"vary": "~1.0.1"
|
||||
},
|
||||
"description": "Override HTTP verbs",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.17",
|
||||
"mocha": "2.2.5",
|
||||
"supertest": "1.0.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "2cd5cdbff00c3673d7ae345119a812a5d95b8c8e",
|
||||
"tarball": "http://registry.npmjs.org/method-override/-/method-override-2.3.5.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "367129dbe18743bcaae8a9300b90621e51825e70",
|
||||
"homepage": "https://github.com/expressjs/method-override",
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "mscdex",
|
||||
"email": "mscdex@mscdex.net"
|
||||
},
|
||||
{
|
||||
"name": "fishrock123",
|
||||
"email": "fishrock123@rocketmail.com"
|
||||
},
|
||||
{
|
||||
"name": "defunctzombie",
|
||||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "method-override",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/expressjs/method-override.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --check-leaks --reporter spec --bail test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/"
|
||||
},
|
||||
"version": "2.3.5"
|
||||
}
|
||||
Reference in New Issue
Block a user