Spaces:
Sleeping
Sleeping
Download backend/src/controllers/user.ts from jacqueshuang/ng: direct link, hf CLI and curl.
- Browser
- Download file 908 Bytes
-
https://huggingface.co/spaces/jacqueshuang/ng/resolve/main/backend/src/controllers/user.ts
- Command line
-
hf download hf://spaces/jacqueshuang/ng/backend/src/controllers/user.ts
-
curl -L -o user.ts https://huggingface.co/spaces/jacqueshuang/ng/resolve/main/backend/src/controllers/user.ts
908 Bytes
| import { Request, Response } from "express"; | |
| import { injectable, inject } from "inversify"; | |
| import { TYPES } from "../core/types"; | |
| import { UserService } from "../services/UserService"; | |
| import { BaseController } from "./BaseController"; | |
| () | |
| export class UserController extends BaseController { | |
| constructor((TYPES.UserService) private userService: UserService) { | |
| super(); | |
| } | |
| async register(req: Request, res: Response): Promise<void> { | |
| await this.handleRequest(req, res, async () => { | |
| const { username, password, registerCode } = req.body; | |
| return await this.userService.register(username, password, registerCode); | |
| }); | |
| } | |
| async login(req: Request, res: Response): Promise<void> { | |
| await this.handleRequest(req, res, async () => { | |
| const { username, password } = req.body; | |
| return await this.userService.login(username, password); | |
| }); | |
| } | |
| } | |