@adriankulik/create-fullstack-app 1.2.0 → 1.4.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.
- package/README.md +13 -7
- package/cli/index.js +165 -75
- package/cli/logo.js +11 -0
- package/package.json +4 -4
- package/templates/backend/dotnet/Program.cs +32 -0
- package/templates/backend/dotnet/Properties/launchSettings.json +41 -0
- package/templates/backend/dotnet/Tests/GlobalUsings.cs +1 -0
- package/templates/backend/dotnet/Tests/Tests.csproj +30 -0
- package/templates/backend/dotnet/Tests/UnitTest1.cs +43 -0
- package/templates/backend/dotnet/Tests/obj/Tests.csproj.nuget.dgspec.json +147 -0
- package/templates/backend/dotnet/Tests/obj/Tests.csproj.nuget.g.props +26 -0
- package/templates/backend/dotnet/Tests/obj/Tests.csproj.nuget.g.targets +15 -0
- package/templates/backend/dotnet/Tests/obj/project.assets.json +7485 -0
- package/templates/backend/dotnet/Tests/obj/project.nuget.cache +132 -0
- package/templates/backend/dotnet/appsettings.Development.json +8 -0
- package/templates/backend/dotnet/appsettings.json +9 -0
- package/templates/backend/dotnet/backend.sln +28 -0
- package/templates/backend/dotnet/dotnet.csproj +17 -0
- package/templates/backend/dotnet/dotnet.http +6 -0
- package/templates/backend/dotnet/lint.sh +2 -0
- package/templates/backend/dotnet/start.sh +2 -0
- package/templates/backend/dotnet/test.sh +2 -0
- package/templates/backend/fastapi/main.py +1 -3
- package/templates/backend/fastapi/test_main.py +0 -4
- package/templates/backend/flask/main.py +1 -3
- package/templates/backend/flask/test_main.py +0 -4
- package/templates/backend/nodejs/.eslintrc.json +15 -0
- package/templates/backend/nodejs/lint.sh +2 -0
- package/templates/backend/nodejs/package-lock.json +5227 -0
- package/templates/backend/nodejs/package.json +27 -0
- package/templates/backend/nodejs/src/index.test.ts +22 -0
- package/templates/backend/nodejs/src/index.ts +23 -0
- package/templates/backend/nodejs/start.sh +2 -0
- package/templates/backend/nodejs/test.sh +2 -0
- 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.19.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,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
|
+
}
|