Skip to content
Permalink
Browse files
only registered user can see article by ID(test)
  • Loading branch information
prosovskyf committed Oct 4, 2020
1 parent deeeb3a commit 4a0927eae066c3090fc30a3074b4dc5fa5e69ea2
Showing 1 changed file with 3 additions and 2 deletions.
@@ -2,14 +2,15 @@ const Router = require('koa-router');
const bodyParser = require('koa-bodyparser');
//adding prefix as articles.js will be used when manipulating with articles on /api/v1/articles/...
const router = Router({prefix: '/api/v1/articles'});
const service = require('../models/articles')
const service = require('../models/articles');
const auth = require('../auth/basic')


// Router methods used - functions
router.get('/', getAll);
router.post('/', bodyParser(), createArticle);
// add view +1 when getById invoked
router.get('/:id([0-9]{1,})', getById);
router.get('/:id([0-9]{1,})', auth, getById);
router.patch('/:id([0-9]{1,})', bodyParser(), updateArticle);
router.del('/:id([0-9]{1,})', deleteArticle);

0 comments on commit 4a0927e

Please sign in to comment.