UNPKG

artmapper

Version:

Spring Boot clone for Node.js with TypeScript/JavaScript - JPA-like ORM, Lombok decorators, dependency injection, and MySQL support

55 lines 2.41 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; // JavaScript example - Spring Boot TS Controller const { Controller, GetMapping, PostMapping, PathVariable, RequestBody } = require('../../index'); const { UserService } = require('./UserService'); let UserController = class UserController { constructor(userService) { this.userService = userService; } async getAllUsers() { return this.userService.getAllUsers(); } async getUserById(id) { return this.userService.getUserById(parseInt(id)); } async createUser(userData) { return this.userService.createUser(userData); } }; __decorate([ GetMapping(''), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise) ], UserController.prototype, "getAllUsers", null); __decorate([ GetMapping('/:id'), __param(0, PathVariable('id')), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise) ], UserController.prototype, "getUserById", null); __decorate([ PostMapping(''), __param(0, RequestBody()), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise) ], UserController.prototype, "createUser", null); UserController = __decorate([ Controller('/api/users'), __metadata("design:paramtypes", [Object]) ], UserController); module.exports = { UserController }; //# sourceMappingURL=UserController.js.map