Migrate historyRouter.js and baseRouter.js to TypeScript

Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
David Mehren 2020-04-12 17:39:35 +02:00
parent 0ca8e2dc7d
commit d44144630f
No known key found for this signature in database
GPG key ID: 6017AF117F9756CB
3 changed files with 18 additions and 24 deletions

View file

@ -1,13 +1,9 @@
'use strict'
import { response } from '../response'
import { errors } from '../errors'
const Router = require('express').Router
const response = require('../response')
const baseRouter = module.exports = Router()
const errors = require('../errors')
// get index
baseRouter.get('/', response.showIndex)
// get 403 forbidden

View file

@ -1,18 +0,0 @@
'use strict'
const Router = require('express').Router
const { urlencodedParser } = require('./utils')
const history = require('../history')
const historyRouter = module.exports = Router()
// get history
historyRouter.get('/history', history.historyGet)
// post history
historyRouter.post('/history', urlencodedParser, history.historyPost)
// post history by note id
historyRouter.post('/history/:noteId', urlencodedParser, history.historyPost)
// delete history
historyRouter.delete('/history', history.historyDelete)
// delete history by note id
historyRouter.delete('/history/:noteId', history.historyDelete)

16
lib/web/historyRouter.ts Normal file
View file

@ -0,0 +1,16 @@
import { urlencodedParser } from './utils'
import { History } from '../history'
const Router = require('express').Router
const historyRouter = module.exports = Router()
// get history
historyRouter.get('/history', History.historyGet)
// post history
historyRouter.post('/history', urlencodedParser, History.historyPost)
// post history by note id
historyRouter.post('/history/:noteId', urlencodedParser, History.historyPost)
// delete history
historyRouter.delete('/history', History.historyDelete)
// delete history by note id
historyRouter.delete('/history/:noteId', History.historyDelete)