Move router to controller
This commit is contained in:
parent
aa0305d1cb
commit
220fc48b35
|
@ -1,7 +1,9 @@
|
||||||
import { Request, Response } from 'express'
|
import { Request, Response, Router } from 'express'
|
||||||
import { AuthenticationService } from '../services/AuthenticationService.js'
|
import { AuthenticationService } from '../services/AuthenticationService.js'
|
||||||
|
|
||||||
export class LoginController {
|
const router = Router()
|
||||||
|
|
||||||
|
class LoginController {
|
||||||
static async login(req: Request, res: Response) {
|
static async login(req: Request, res: Response) {
|
||||||
const { username, password } = req.body
|
const { username, password } = req.body
|
||||||
|
|
||||||
|
@ -18,3 +20,7 @@ export class LoginController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
router.post('/', LoginController.login)
|
||||||
|
|
||||||
|
export default router
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
import { LoginController } from '../controllers/LoginController.js'
|
|
||||||
import { Router } from 'express'
|
|
||||||
|
|
||||||
const router = Router()
|
|
||||||
|
|
||||||
router.post('/', LoginController.login)
|
|
||||||
|
|
||||||
export default router
|
|
|
@ -4,7 +4,7 @@ import bodyParser from 'body-parser'
|
||||||
import { injectUserMiddleware } from './middleware/injectUserMiddleware.js'
|
import { injectUserMiddleware } from './middleware/injectUserMiddleware.js'
|
||||||
import { authMiddleware } from './middleware/authMiddleware.js'
|
import { authMiddleware } from './middleware/authMiddleware.js'
|
||||||
|
|
||||||
import LoginRouter from './routers/LoginRouter.js'
|
import LoginRouter from './controllers/LoginController.js'
|
||||||
|
|
||||||
export const app = express()
|
export const app = express()
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
"target": "ES2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
"target": "ES2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||||
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
"experimentalDecorators": true /* Enable experimental support for legacy experimental decorators. */,
|
||||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
"emitDecoratorMetadata": true /* Emit design-type metadata for decorated declarations in source files. */,
|
||||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user