Skip to content

Commit

Permalink
Added authenticate route
Browse files Browse the repository at this point in the history
  • Loading branch information
maulik9898 committed May 14, 2022
1 parent 6b7f3a3 commit 4276916
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 0 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ app.get('/', async (req: Request, res: Response) => {
res.status(200).json({status:'ok'});
});

app.use('/',router)

app.use(errorLogger)
app.use(errorMiddleware)

Expand Down
7 changes: 7 additions & 0 deletions src/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,10 @@ export const getClients = async (req: Request, res: Response, next: NextFunction
return next(new HttpException(500,error.message))
}
}


export const authenticate = async (req: Request, res: Response,next: NextFunction) => {
res.status(200).json({
status: 'success'
})
}
3 changes: 2 additions & 1 deletion src/routes/routes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Router } from 'express';
import { getClients, login, registerUser, setPubKey } from '../controllers/auth.controller'
import { authenticate, getClients, login, registerUser, setPubKey } from '../controllers/auth.controller'
import { refreshToken } from '../controllers/refreshToken.controller';
import { authenticateJWT, isAdmin } from '../middleware/auth.middleware';
import { loginValidation, setPubKeyValidation, tokenValidation, validate } from '../middleware/validators.middleware';
Expand All @@ -15,4 +15,5 @@ router.post('/pubkey',validate(setPubKeyValidation),authenticateJWT , setPubKey)

router.get('/clients',authenticateJWT,getClients)

router.get('/authenticate',authenticateJWT , authenticate)

0 comments on commit 4276916

Please sign in to comment.