@gasket/template-api-fastify 0.0.0-canary-20250922153852
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/LICENSE.md +21 -0
- package/README.md +0 -0
- package/package.json +29 -0
- package/template/README.md +92 -0
- package/template/gasket.ts +46 -0
- package/template/package-lock.json +22887 -0
- package/template/package.json +64 -0
- package/template/plugins/README.md +11 -0
- package/template/plugins/routes-plugin.ts +27 -0
- package/template/server.ts +4 -0
- package/template/swagger.json +28 -0
- package/template/test/index.test.ts +21 -0
- package/template/tsconfig.json +33 -0
- package/template/vitest.config.js +8 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{{appName}}}",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Gasket App",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"docs": "tsx gasket.ts docs",
|
|
7
|
+
"prebuild": "tsx gasket.ts build",
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"preview": "npm run build && npm run start",
|
|
10
|
+
"start": "node dist/server.js",
|
|
11
|
+
"local": "tsx watch server.ts",
|
|
12
|
+
"test": "vitest run",
|
|
13
|
+
"test:watch": "vitest",
|
|
14
|
+
"test:coverage": "vitest run --coverage",
|
|
15
|
+
"lint": "eslint --ext .js,.jsx,.cjs,.ts,.tsx .",
|
|
16
|
+
"lint:fix": "npm run lint -- --fix",
|
|
17
|
+
"posttest": "npm run lint"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@gasket/core": "^7.5.2",
|
|
21
|
+
"@gasket/plugin-command": "^7.5.2",
|
|
22
|
+
"@gasket/plugin-dynamic-plugins": "^7.4.1",
|
|
23
|
+
"@gasket/plugin-fastify": "^7.4.5",
|
|
24
|
+
"@gasket/plugin-https": "^7.3.11",
|
|
25
|
+
"@gasket/plugin-logger": "^7.3.7",
|
|
26
|
+
"@gasket/plugin-swagger": "^7.3.9",
|
|
27
|
+
"@gasket/plugin-winston": "^7.3.7",
|
|
28
|
+
"@gasket/request": "^7.4.3",
|
|
29
|
+
"@gasket/utils": "^7.4.2",
|
|
30
|
+
"fastify": "^4.29.1",
|
|
31
|
+
"winston": "^3.17.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@docusaurus/core": "^3.8.1",
|
|
35
|
+
"@docusaurus/preset-classic": "^3.8.1",
|
|
36
|
+
"@gasket/plugin-docs": "^7.4.7",
|
|
37
|
+
"@gasket/plugin-docusaurus": "^7.4.5",
|
|
38
|
+
"@gasket/plugin-metadata": "^7.5.3",
|
|
39
|
+
"@typescript-eslint/parser": "^8.38.0",
|
|
40
|
+
"@vitest/coverage-v8": "^3.2.0",
|
|
41
|
+
"ajv": "^8.17.1",
|
|
42
|
+
"eslint": "^8.57.1",
|
|
43
|
+
"eslint-config-godaddy": "^7.1.1",
|
|
44
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
45
|
+
"react": "^19.0.0",
|
|
46
|
+
"react-dom": "^19.0.0",
|
|
47
|
+
"search-insights": "^2.17.3",
|
|
48
|
+
"tsx": "^4.19.3",
|
|
49
|
+
"typescript": "^5.8.2",
|
|
50
|
+
"vitest": "^3.2.0"
|
|
51
|
+
},
|
|
52
|
+
"type": "module",
|
|
53
|
+
"eslintIgnore": [
|
|
54
|
+
"dist",
|
|
55
|
+
"coverage/",
|
|
56
|
+
"build/"
|
|
57
|
+
],
|
|
58
|
+
"eslintConfig": {
|
|
59
|
+
"extends": [
|
|
60
|
+
"godaddy"
|
|
61
|
+
],
|
|
62
|
+
"parser": "@typescript-eslint/parser"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const defaultHandler = async (req, res) => {
|
|
2
|
+
if (res.statusCode === 200) {
|
|
3
|
+
res.send({ message: 'Welcome to your default route...' });
|
|
4
|
+
}
|
|
5
|
+
};
|
|
6
|
+
export default {
|
|
7
|
+
name: 'routes-plugin',
|
|
8
|
+
hooks: {
|
|
9
|
+
fastify(gasket, app) {
|
|
10
|
+
/**
|
|
11
|
+
* @swagger
|
|
12
|
+
*
|
|
13
|
+
* /default:
|
|
14
|
+
* get:
|
|
15
|
+
* summary: "Get default route"
|
|
16
|
+
* produces:
|
|
17
|
+
* - "application/json"
|
|
18
|
+
* responses:
|
|
19
|
+
* "200":
|
|
20
|
+
* description: "Returns welcome message."
|
|
21
|
+
* content:
|
|
22
|
+
* application/json
|
|
23
|
+
*/
|
|
24
|
+
app.get('/default', defaultHandler);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"info": {
|
|
3
|
+
"title": "fastify-ts",
|
|
4
|
+
"version": "0.0.0"
|
|
5
|
+
},
|
|
6
|
+
"swagger": "2.0",
|
|
7
|
+
"paths": {
|
|
8
|
+
"/default": {
|
|
9
|
+
"get": {
|
|
10
|
+
"summary": "Get default route",
|
|
11
|
+
"produces": [
|
|
12
|
+
"application/json"
|
|
13
|
+
],
|
|
14
|
+
"responses": {
|
|
15
|
+
"200": {
|
|
16
|
+
"description": "Returns welcome message.",
|
|
17
|
+
"content": "application/json"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"definitions": {},
|
|
24
|
+
"responses": {},
|
|
25
|
+
"parameters": {},
|
|
26
|
+
"securityDefinitions": {},
|
|
27
|
+
"tags": []
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
|
+
import { defaultHandler } from '../plugins/routes-plugin.js';
|
|
3
|
+
|
|
4
|
+
describe('Routes', () => {
|
|
5
|
+
let mockRequest, mockResponse;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
mockRequest = {};
|
|
9
|
+
mockResponse = {
|
|
10
|
+
statusCode: 200,
|
|
11
|
+
send: vi.fn()
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('defaultHeader should use expected message', async () => {
|
|
16
|
+
await defaultHandler(mockRequest, mockResponse);
|
|
17
|
+
expect(mockResponse.send).toHaveBeenCalledWith({
|
|
18
|
+
message: 'Welcome to your default route...'
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"skipLibCheck": true,
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"target": "ESNext",
|
|
7
|
+
"isolatedModules": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"outDir": "dist",
|
|
11
|
+
"lib": [
|
|
12
|
+
"esnext"
|
|
13
|
+
],
|
|
14
|
+
"types": [
|
|
15
|
+
"node"
|
|
16
|
+
],
|
|
17
|
+
"baseUrl": "./",
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"strict": false,
|
|
20
|
+
"incremental": true,
|
|
21
|
+
"resolveJsonModule": true
|
|
22
|
+
},
|
|
23
|
+
"exclude": [
|
|
24
|
+
"node_modules"
|
|
25
|
+
],
|
|
26
|
+
"include": [
|
|
27
|
+
"./plugins",
|
|
28
|
+
"./routes",
|
|
29
|
+
"gasket-data.ts",
|
|
30
|
+
"server.ts",
|
|
31
|
+
"gasket.ts"
|
|
32
|
+
]
|
|
33
|
+
}
|