Skip to content

Commit

Permalink
removing default instance with versions routes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonwinton committed Aug 30, 2017
1 parent fd6cf53 commit 293a71d
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions lib/routes/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ const _ = require('lodash'),
files = require('../files'),
queryStringOptions = ['ignore-data'],
{ withAuthLevel, authLevels } = require('../auth'),
controller = require('../services/components');
controller = require('../services/components'),
acceptedExtensions = {
json: 'application/json'
};

let validation, route;

Expand Down Expand Up @@ -218,15 +221,19 @@ function routes(router) {
router.all('/:name*', validation.componentMustExist);
router.get('/:name.:ext', route.getExtension);

router.all('/:name@:version', responses.acceptJSONOnly);
router.all('/:name@:version', responses.methodNotAllowed({
allow: ['get', 'put']
}));
router.all('/:name@:version', responses.denyTrailingSlashOnId);
router.get('/:name@:version', route.get);
router.put('/:name@:version', responses.denyReferenceAtRoot);
router.put('/:name@:version', route.put);
router.put('/:name@:version', withAuthLevel(authLevels.WRITE));
// router.all('/:name@:version', responses.acceptJSONOnly);
// router.all('/:name@:version', responses.methodNotAllowed({
// allow: ['get', 'put']
// }));
// router.all('/:name@:version', responses.denyTrailingSlashOnId);
// router.get('/:name@:version', route.get);
// router.put('/:name@:version', responses.denyReferenceAtRoot);
//
// router.put('/:name@:version', route.put);
// router.put('/:name@:version', withAuthLevel(authLevels.WRITE));


// router.put('/:name.:ext', responses.onlyAcceptExtensions({extensions: acceptedExtensions}));

router.all('/:name', responses.acceptJSONOnly);
router.all('/:name', responses.methodNotAllowed({
Expand Down

0 comments on commit 293a71d

Please sign in to comment.