create-hest-app 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-hest-app",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "description": "Create HestJS-powered applications with one command",
6
6
  "keywords": [
@@ -1,41 +1,43 @@
1
- import { Controller, Get, Param, Post } from "@hestjs/core";
1
+ import { Controller, Get, Param, Post } from '@hestjs/core';
2
2
 
3
- import { Body } from "@hestjs/validation";
4
- import { AppService } from "./app.service";
5
- import { CreateUserDto } from "./modules/users/dto/user.dto";
3
+ import { Body } from '@hestjs/validation';
4
+ import { AppService } from './app.service';
5
+ import { CreateUserDto } from './modules/users/dto/user.dto';
6
6
 
7
- @Controller("/api")
7
+ @Controller('/api')
8
8
  export class AppController {
9
9
  constructor(private readonly appService: AppService) {}
10
10
 
11
- @Get("/")
11
+ @Get('/')
12
12
  getHello() {
13
13
  return { message: this.appService.getHello() };
14
14
  }
15
15
 
16
- @Get("/users")
16
+ @Get('/users')
17
17
  getUsers() {
18
18
  return this.appService.getUsers();
19
19
  }
20
20
 
21
- @Get("/users/:id")
22
- getUser(@Param("id") id: string) {
21
+ @Get('/users/:id')
22
+ getUser(@Param('id') id: string) {
23
23
  const user = this.appService.getUser(id);
24
24
  if (!user) {
25
- const error = new Error(`User with id ${id} not found`) as Error & { status: number };
25
+ const error = new Error(`User with id ${id} not found`) as Error & {
26
+ status: number;
27
+ };
26
28
  error.status = 404;
27
29
  throw error;
28
30
  }
29
31
  return user;
30
32
  }
31
33
 
32
- @Post("/users")
34
+ @Post('/users')
33
35
  createUser(@Body(CreateUserDto) createUserDto: CreateUserDto) {
34
36
  return this.appService.createUser(createUserDto);
35
37
  }
36
38
 
37
- @Get("/error")
39
+ @Get('/error')
38
40
  throwError() {
39
- throw new Error("This is a test error");
41
+ throw new Error('This is a test error');
40
42
  }
41
43
  }
@@ -1,13 +1,13 @@
1
- import { HestFactory } from "@hestjs/core";
2
- import { logger } from "@hestjs/logger";
3
- import { Hono } from "hono";
4
- import { cors } from "hono/cors";
5
- import { AppModule } from "./app.module";
6
- import { exceptionMiddleware, responseMiddleware } from "./common/middleware";
1
+ import { HestFactory } from '@hestjs/core';
2
+ import { logger } from '@hestjs/logger';
3
+ import { Hono } from 'hono';
4
+ import { cors } from 'hono/cors';
5
+ import { AppModule } from './app.module';
6
+ import { exceptionMiddleware, responseMiddleware } from './common/middleware';
7
7
 
8
8
  async function bootstrap() {
9
9
  try {
10
- logger.info("🚀 Starting HestJS application...");
10
+ logger.info('🚀 Starting HestJS application...');
11
11
 
12
12
  // 创建 Hono 实例
13
13
  const hono = new Hono();
@@ -26,7 +26,7 @@ async function bootstrap() {
26
26
 
27
27
  logger.info(`🎉 Server is running on http://localhost:3002`);
28
28
  } catch (error) {
29
- logger.error("❌ Failed to start application:", error);
29
+ logger.error('❌ Failed to start application:', error);
30
30
  process.exit(1);
31
31
  }
32
32
  }