create-phoenixjs 0.1.3 → 0.1.5

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.
Files changed (59) hide show
  1. package/package.json +1 -1
  2. package/template/app/controllers/HealthController.ts +22 -0
  3. package/template/app/gateways/EchoGateway.ts +58 -0
  4. package/template/bootstrap/app.ts +2 -7
  5. package/template/config/app.ts +12 -0
  6. package/template/config/database.ts +13 -1
  7. package/template/database/migrations/2024_01_01_000000_create_test_users_cli_table.ts +16 -0
  8. package/template/database/migrations/20260108164611_TestCliMigration.ts +16 -0
  9. package/template/database/migrations/2026_01_08_16_46_11_CreateTestMigrationsTable.ts +21 -0
  10. package/template/framework/cli/artisan.ts +12 -0
  11. package/template/framework/core/Application.ts +15 -0
  12. package/template/framework/database/DatabaseManager.ts +133 -0
  13. package/template/framework/database/connection/Connection.ts +71 -0
  14. package/template/framework/database/connection/ConnectionFactory.ts +30 -0
  15. package/template/framework/database/connection/PostgresConnection.ts +159 -0
  16. package/template/framework/database/console/MakeMigrationCommand.ts +58 -0
  17. package/template/framework/database/console/MigrateCommand.ts +32 -0
  18. package/template/framework/database/console/MigrateResetCommand.ts +31 -0
  19. package/template/framework/database/console/MigrateRollbackCommand.ts +31 -0
  20. package/template/framework/database/console/MigrateStatusCommand.ts +38 -0
  21. package/template/framework/database/migrations/DatabaseMigrationRepository.ts +122 -0
  22. package/template/framework/database/migrations/Migration.ts +5 -0
  23. package/template/framework/database/migrations/MigrationRepository.ts +46 -0
  24. package/template/framework/database/migrations/Migrator.ts +249 -0
  25. package/template/framework/database/migrations/index.ts +4 -0
  26. package/template/framework/database/orm/BelongsTo.ts +246 -0
  27. package/template/framework/database/orm/BelongsToMany.ts +570 -0
  28. package/template/framework/database/orm/Builder.ts +160 -0
  29. package/template/framework/database/orm/EagerLoadingBuilder.ts +324 -0
  30. package/template/framework/database/orm/HasMany.ts +303 -0
  31. package/template/framework/database/orm/HasManyThrough.ts +282 -0
  32. package/template/framework/database/orm/HasOne.ts +201 -0
  33. package/template/framework/database/orm/HasOneThrough.ts +281 -0
  34. package/template/framework/database/orm/Model.ts +1766 -0
  35. package/template/framework/database/orm/Relation.ts +342 -0
  36. package/template/framework/database/orm/Scope.ts +14 -0
  37. package/template/framework/database/orm/SoftDeletes.ts +160 -0
  38. package/template/framework/database/orm/index.ts +54 -0
  39. package/template/framework/database/orm/scopes/SoftDeletingScope.ts +58 -0
  40. package/template/framework/database/pagination/LengthAwarePaginator.ts +55 -0
  41. package/template/framework/database/pagination/Paginator.ts +110 -0
  42. package/template/framework/database/pagination/index.ts +2 -0
  43. package/template/framework/database/query/Builder.ts +918 -0
  44. package/template/framework/database/query/DB.ts +139 -0
  45. package/template/framework/database/query/grammars/Grammar.ts +430 -0
  46. package/template/framework/database/query/grammars/PostgresGrammar.ts +224 -0
  47. package/template/framework/database/query/grammars/index.ts +6 -0
  48. package/template/framework/database/query/index.ts +8 -0
  49. package/template/framework/database/query/types.ts +196 -0
  50. package/template/framework/database/schema/Blueprint.ts +478 -0
  51. package/template/framework/database/schema/Schema.ts +149 -0
  52. package/template/framework/database/schema/SchemaBuilder.ts +152 -0
  53. package/template/framework/database/schema/grammars/PostgresSchemaGrammar.ts +293 -0
  54. package/template/framework/database/schema/grammars/index.ts +5 -0
  55. package/template/framework/database/schema/index.ts +9 -0
  56. package/template/framework/log/Logger.ts +195 -0
  57. package/template/package.json +4 -1
  58. package/template/routes/api.ts +13 -35
  59. package/template/app/controllers/ExampleController.ts +0 -61
@@ -1,56 +1,34 @@
1
1
  import { Router } from '@framework/routing/Router';
2
2
  import { FrameworkResponse as Response } from '@framework/http/Response';
3
3
 
4
- /**
5
- * API Routes
6
- *
7
- * Define your API routes here. These routes are loaded by the kernel
8
- * and all routes here will have the /api prefix.
9
- */
10
4
  export function registerRoutes() {
11
- // Health check endpoint
12
- Router.get('/health', () => {
5
+
6
+ Router.get('/', () => {
13
7
  return Response.json({
14
- status: 'ok',
15
- timestamp: new Date().toISOString(),
8
+ name: 'PhoenixJS',
9
+ version: '0.1.0',
10
+ message: 'Welcome to PhoenixJS'
16
11
  });
17
12
  });
18
13
 
19
- // Welcome endpoint
20
- Router.get('/hello', () => {
14
+ Router.get('/health', () => {
21
15
  return Response.json({
22
- message: 'Welcome to PhoenixJS! 🚀',
16
+ status: 'healthy',
17
+ timestamp: new Date().toISOString(),
18
+ uptime: process.uptime()
23
19
  });
24
20
  });
25
21
 
26
- // Example API group with routes
22
+ // Sample API group
27
23
  Router.group({ prefix: '/api' }, () => {
28
- // Ping endpoint
29
24
  Router.get('/ping', () => Response.json({ message: 'pong' }));
30
25
 
31
- // Example with route parameter
32
26
  Router.get('/users/:id', () => {
33
- return Response.json({
34
- user: { id: '1', name: 'John Doe' },
35
- });
27
+ return Response.json({ id: '123' });
36
28
  });
37
29
 
38
- // Example POST route (use Controller for real implementations)
39
- Router.post('/users', () => {
40
- return Response.json({
41
- message: 'User created',
42
- }, 201);
30
+ Router.group({ prefix: '/v1' }, () => {
31
+ Router.get('/count', () => Response.json({ count: 1 }));
43
32
  });
44
33
  });
45
-
46
- /**
47
- * Route Groups Example
48
- *
49
- * You can use Controllers with the 'ControllerName@method' syntax:
50
- *
51
- * Router.group({ prefix: '/v1', middleware: [] }, () => {
52
- * Router.get('/products', 'ProductController@index');
53
- * Router.post('/products', 'ProductController@store');
54
- * });
55
- */
56
34
  }
@@ -1,61 +0,0 @@
1
- import { Controller } from '@framework/controller/Controller';
2
-
3
- /**
4
- * Example Controller
5
- *
6
- * This is a sample controller to get you started.
7
- * Generate new controllers using: bun artisan make:controller <name>
8
- */
9
- export class ExampleController extends Controller {
10
- /**
11
- * Display a listing of the resource.
12
- */
13
- async index() {
14
- return this.json({
15
- message: 'Welcome to PhoenixJS!',
16
- items: [],
17
- });
18
- }
19
-
20
- /**
21
- * Display the specified resource.
22
- */
23
- async show() {
24
- const id = this.param('id');
25
- return this.json({
26
- id,
27
- message: `Showing resource ${id}`,
28
- });
29
- }
30
-
31
- /**
32
- * Store a newly created resource.
33
- */
34
- async store() {
35
- const data = await this.request.json();
36
- return this.json({
37
- message: 'Resource created successfully',
38
- data,
39
- }, 201);
40
- }
41
-
42
- /**
43
- * Update the specified resource.
44
- */
45
- async update() {
46
- const id = this.param('id');
47
- const data = await this.request.json();
48
- return this.json({
49
- message: `Resource ${id} updated`,
50
- data,
51
- });
52
- }
53
-
54
- /**
55
- * Remove the specified resource.
56
- */
57
- async destroy() {
58
- const id = this.param('id');
59
- return this.noContent();
60
- }
61
- }