yeps-method-override
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
tests
.editorconfig
.eslintrc
.gitignore
.istanbul.yml
.travis.yml
LICENSE
README.md
appveyor.yml
index.js
package.json

README.md

YEPS Method Override

NPM

npm version Build Status Coverage Status Linux Build Windows Build

Dependency Status devDependency Status NSP Status

License GitHub stars GitHub forks GitHub issues Twitter

How to install

npm i -S yeps-method-override

How to use

Header x-http-method-override or in body request

const App = require('yeps');
const Router = require('yeps-router');

const error = require('yeps-error');
const logger = require('yeps-logger');
const server = require('yeps-server');

const bodyParser = require('yeps-bodyparser');
const methodOverride = require('yeps-method-override');

const app = new App();
const router = new Router();

app.all([
    error(),
    logger(),
    bodyParser(),
    methodOverride(),
]);

app.then(async (ctx) => {
    ctx.res.statusCode = 200;
    ctx.res.end(JSON.stringify(ctx.req.method));
});

router.get('/').then(async (ctx) => {
   ctx.res.statusCode = 200;
   ctx.res.end('homepage');     
});
    
app.then(router.resolve());
    
server.createHttpServer(app);

YEPS documentation