generated from Greenstand/treetracker-microservice-template
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a533643
commit dd73c73
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import express from 'express'; | ||
import Joi from 'joi'; | ||
import { handlerWrapper } from './utils'; | ||
import Session from '../infra/database/Session'; | ||
import TokensRepository from '../infra/database/TokensRepository'; | ||
import TokensModel from '../models/tokens'; | ||
|
||
const router = express.Router(); | ||
|
||
router.get( | ||
'/:tokenId', | ||
handlerWrapper(async (req, res) => { | ||
Joi.assert(req.params.tokenId, Joi.number().required()); | ||
const repo = new TokensRepository(new Session()); | ||
const exe = TokensModel.getById(repo); | ||
const result = await exe(req.params.tokenId); | ||
res.send(result); | ||
res.end(); | ||
}), | ||
); |