@adriankulik/create-fullstack-app 1.3.0 → 1.5.0

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 (35) hide show
  1. package/README.md +25 -9
  2. package/cli/index.js +191 -76
  3. package/cli/logo.js +8 -8
  4. package/package.json +4 -4
  5. package/templates/backend/dotnet/Program.cs +32 -0
  6. package/templates/backend/dotnet/Properties/launchSettings.json +41 -0
  7. package/templates/backend/dotnet/Tests/GlobalUsings.cs +1 -0
  8. package/templates/backend/dotnet/Tests/Tests.csproj +30 -0
  9. package/templates/backend/dotnet/Tests/UnitTest1.cs +43 -0
  10. package/templates/backend/dotnet/Tests/obj/Tests.csproj.nuget.dgspec.json +147 -0
  11. package/templates/backend/dotnet/Tests/obj/Tests.csproj.nuget.g.props +26 -0
  12. package/templates/backend/dotnet/Tests/obj/Tests.csproj.nuget.g.targets +15 -0
  13. package/templates/backend/dotnet/Tests/obj/project.assets.json +7485 -0
  14. package/templates/backend/dotnet/Tests/obj/project.nuget.cache +132 -0
  15. package/templates/backend/dotnet/appsettings.Development.json +8 -0
  16. package/templates/backend/dotnet/appsettings.json +9 -0
  17. package/templates/backend/dotnet/backend.sln +28 -0
  18. package/templates/backend/dotnet/dotnet.csproj +17 -0
  19. package/templates/backend/dotnet/dotnet.http +6 -0
  20. package/templates/backend/dotnet/lint.sh +2 -0
  21. package/templates/backend/dotnet/start.sh +2 -0
  22. package/templates/backend/dotnet/test.sh +2 -0
  23. package/templates/backend/fastapi/main.py +1 -3
  24. package/templates/backend/fastapi/test_main.py +0 -4
  25. package/templates/backend/flask/main.py +1 -3
  26. package/templates/backend/flask/test_main.py +0 -4
  27. package/templates/backend/nodejs/.eslintrc.json +15 -0
  28. package/templates/backend/nodejs/lint.sh +2 -0
  29. package/templates/backend/nodejs/package-lock.json +5227 -0
  30. package/templates/backend/nodejs/package.json +27 -0
  31. package/templates/backend/nodejs/src/index.test.ts +22 -0
  32. package/templates/backend/nodejs/src/index.ts +23 -0
  33. package/templates/backend/nodejs/start.sh +2 -0
  34. package/templates/backend/nodejs/test.sh +2 -0
  35. package/templates/backend/nodejs/tsconfig.json +14 -0
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "backend",
3
+ "version": "1.0.0",
4
+ "main": "src/index.ts",
5
+ "scripts": {
6
+ "start": "tsx src/index.ts",
7
+ "test": "vitest run",
8
+ "lint": "eslint . --ext .ts --fix"
9
+ },
10
+ "dependencies": {
11
+ "cors": "^2.8.5",
12
+ "express": "^4.22.2"
13
+ },
14
+ "devDependencies": {
15
+ "@types/cors": "^2.8.17",
16
+ "@types/express": "^4.17.21",
17
+ "@types/node": "^20.12.7",
18
+ "@types/supertest": "^6.0.2",
19
+ "@typescript-eslint/eslint-plugin": "^7.7.1",
20
+ "@typescript-eslint/parser": "^7.7.1",
21
+ "eslint": "^8.57.0",
22
+ "supertest": "^7.0.0",
23
+ "tsx": "^4.7.2",
24
+ "typescript": "^5.4.5",
25
+ "vitest": "^1.6.0"
26
+ }
27
+ }
@@ -0,0 +1,22 @@
1
+ import request from 'supertest';
2
+ import app from './index';
3
+ import { describe, it, expect } from 'vitest';
4
+
5
+ describe('Multiply API', () => {
6
+ it('should multiply a valid number by 2', async () => {
7
+ const res = await request(app)
8
+ .post('/api/multiply')
9
+ .send({ number: 5 });
10
+
11
+ expect(res.statusCode).toEqual(200);
12
+ expect(res.body).toEqual({ result: 10 });
13
+ });
14
+
15
+ it('should return 400 for invalid input', async () => {
16
+ const res = await request(app)
17
+ .post('/api/multiply')
18
+ .send({ number: 'not a number' });
19
+
20
+ expect(res.statusCode).toEqual(400);
21
+ });
22
+ });
@@ -0,0 +1,23 @@
1
+ import express, { Request, Response } from 'express';
2
+ import cors from 'cors';
3
+
4
+ const app = express();
5
+ app.use(cors());
6
+ app.use(express.json());
7
+
8
+ app.post('/api/multiply', (req: Request, res: Response) => {
9
+ const { number } = req.body;
10
+ if (typeof number !== 'number') {
11
+ return res.status(400).json({ error: 'Invalid number' });
12
+ }
13
+ return res.json({ result: number * 2 });
14
+ });
15
+
16
+ if (process.env.NODE_ENV !== 'test') {
17
+ const port = process.env.PORT || 8000;
18
+ app.listen(port, () => {
19
+ console.log(`Server running on port ${port}`);
20
+ });
21
+ }
22
+
23
+ export default app;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bash
2
+ npm start
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bash
2
+ npm test
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "CommonJS",
5
+ "moduleResolution": "node",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "outDir": "./dist",
11
+ "rootDir": "./src"
12
+ },
13
+ "include": ["src/**/*"]
14
+ }