nexpgen 1.0.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.
@@ -0,0 +1,42 @@
1
+ const express = require('express');
2
+ {{#if useDotenv}}
3
+ require('dotenv').config();
4
+ {{/if}}
5
+ {{#if useHelmet}}
6
+ const helmet = require('helmet');
7
+ {{/if}}
8
+
9
+ const app = express();
10
+ const port = process.env.PORT || 3000;
11
+
12
+ const setupMiddleware = () => {
13
+ {{#if useHelmet}}
14
+ app.use(helmet());
15
+ {{/if}}
16
+ app.use(express.json());
17
+ app.use(express.urlencoded({ extended: true }));
18
+ };
19
+
20
+ const setupRoutes = () => {
21
+ app.get('/', (req, res) => {
22
+ res.json({ message: 'Welcome to Clean Architecture Application' });
23
+ });
24
+
25
+ // TODO: Add your routes here
26
+ // const userRoutes = require('./src/presentation/routes/userRoutes');
27
+ // app.use('/api/users', userRoutes);
28
+ };
29
+
30
+ const start = () => {
31
+ setupMiddleware();
32
+ setupRoutes();
33
+
34
+ app.listen(port, () => {
35
+ console.log(\`🚀 Server running on port \${port}\`);
36
+ });
37
+ };
38
+
39
+ start();
40
+
41
+ module.exports = { app, start };
42
+
@@ -0,0 +1,46 @@
1
+ const express = require('express');
2
+ {{#if useDotenv}}
3
+ require('dotenv').config();
4
+ {{/if}}
5
+ {{#if useHelmet}}
6
+ const helmet = require('helmet');
7
+ {{/if}}
8
+
9
+ class Server {
10
+ constructor() {
11
+ this.app = express();
12
+ this.port = process.env.PORT || 3000;
13
+ this.setupMiddleware();
14
+ this.setupRoutes();
15
+ }
16
+
17
+ setupMiddleware() {
18
+ {{#if useHelmet}}
19
+ this.app.use(helmet());
20
+ {{/if}}
21
+ this.app.use(express.json());
22
+ this.app.use(express.urlencoded({ extended: true }));
23
+ }
24
+
25
+ setupRoutes() {
26
+ this.app.get('/', (req, res) => {
27
+ res.json({ message: 'Welcome to Clean Architecture Application' });
28
+ });
29
+
30
+ // TODO: Add your routes here
31
+ // const userRoutes = require('./src/presentation/routes/userRoutes');
32
+ // this.app.use('/api/users', userRoutes);
33
+ }
34
+
35
+ start() {
36
+ this.app.listen(this.port, () => {
37
+ console.log(\`🚀 Server running on port \${this.port}\`);
38
+ });
39
+ }
40
+ }
41
+
42
+ const server = new Server();
43
+ server.start();
44
+
45
+ module.exports = Server;
46
+
@@ -0,0 +1,42 @@
1
+ const express = require('express');
2
+ {{#if useDotenv}}
3
+ require('dotenv').config();
4
+ {{/if}}
5
+ {{#if useHelmet}}
6
+ const helmet = require('helmet');
7
+ {{/if}}
8
+
9
+ const app = express();
10
+ const port = process.env.PORT || 3000;
11
+
12
+ const setupMiddleware = () => {
13
+ {{#if useHelmet}}
14
+ app.use(helmet());
15
+ {{/if}}
16
+ app.use(express.json());
17
+ app.use(express.urlencoded({ extended: true }));
18
+ };
19
+
20
+ const setupRoutes = () => {
21
+ app.get('/', (req, res) => {
22
+ res.json({ message: 'Welcome to Layered Architecture Application' });
23
+ });
24
+
25
+ // TODO: Add your routes here
26
+ // const userRoutes = require('./src/presentation/routes/userRoutes');
27
+ // app.use('/api/users', userRoutes);
28
+ };
29
+
30
+ const start = () => {
31
+ setupMiddleware();
32
+ setupRoutes();
33
+
34
+ app.listen(port, () => {
35
+ console.log(\`🚀 Server running on port \${port}\`);
36
+ });
37
+ };
38
+
39
+ start();
40
+
41
+ module.exports = { app, start };
42
+
@@ -0,0 +1,46 @@
1
+ const express = require('express');
2
+ {{#if useDotenv}}
3
+ require('dotenv').config();
4
+ {{/if}}
5
+ {{#if useHelmet}}
6
+ const helmet = require('helmet');
7
+ {{/if}}
8
+
9
+ class Server {
10
+ constructor() {
11
+ this.app = express();
12
+ this.port = process.env.PORT || 3000;
13
+ this.setupMiddleware();
14
+ this.setupRoutes();
15
+ }
16
+
17
+ setupMiddleware() {
18
+ {{#if useHelmet}}
19
+ this.app.use(helmet());
20
+ {{/if}}
21
+ this.app.use(express.json());
22
+ this.app.use(express.urlencoded({ extended: true }));
23
+ }
24
+
25
+ setupRoutes() {
26
+ this.app.get('/', (req, res) => {
27
+ res.json({ message: 'Welcome to Layered Architecture Application' });
28
+ });
29
+
30
+ // TODO: Add your routes here
31
+ // const userRoutes = require('./src/presentation/routes/userRoutes');
32
+ // this.app.use('/api/users', userRoutes);
33
+ }
34
+
35
+ start() {
36
+ this.app.listen(this.port, () => {
37
+ console.log(\`🚀 Server running on port \${this.port}\`);
38
+ });
39
+ }
40
+ }
41
+
42
+ const server = new Server();
43
+ server.start();
44
+
45
+ module.exports = Server;
46
+
@@ -0,0 +1,41 @@
1
+ const express = require('express');
2
+ {{#if useDotenv}}
3
+ require('dotenv').config();
4
+ {{/if}}
5
+ {{#if useHelmet}}
6
+ const helmet = require('helmet');
7
+ {{/if}}
8
+
9
+ const app = express();
10
+ const port = process.env.PORT || 3000;
11
+
12
+ const setupMiddleware = () => {
13
+ {{#if useHelmet}}
14
+ app.use(helmet());
15
+ {{/if}}
16
+ app.use(express.json());
17
+ app.use(express.urlencoded({ extended: true }));
18
+ };
19
+
20
+ const setupRoutes = () => {
21
+ app.get('/', (req, res) => {
22
+ res.json({ message: 'API Gateway - Microservices Architecture' });
23
+ });
24
+
25
+ // TODO: Add service routes here
26
+ // app.use('/api/users', require('./services/user-service/src/routes'));
27
+ };
28
+
29
+ const start = () => {
30
+ setupMiddleware();
31
+ setupRoutes();
32
+
33
+ app.listen(port, () => {
34
+ console.log(\`🚀 API Gateway running on port \${port}\`);
35
+ });
36
+ };
37
+
38
+ start();
39
+
40
+ module.exports = { app, start };
41
+
@@ -0,0 +1,45 @@
1
+ const express = require('express');
2
+ {{#if useDotenv}}
3
+ require('dotenv').config();
4
+ {{/if}}
5
+ {{#if useHelmet}}
6
+ const helmet = require('helmet');
7
+ {{/if}}
8
+
9
+ class ApiGateway {
10
+ constructor() {
11
+ this.app = express();
12
+ this.port = process.env.PORT || 3000;
13
+ this.setupMiddleware();
14
+ this.setupRoutes();
15
+ }
16
+
17
+ setupMiddleware() {
18
+ {{#if useHelmet}}
19
+ this.app.use(helmet());
20
+ {{/if}}
21
+ this.app.use(express.json());
22
+ this.app.use(express.urlencoded({ extended: true }));
23
+ }
24
+
25
+ setupRoutes() {
26
+ this.app.get('/', (req, res) => {
27
+ res.json({ message: 'API Gateway - Microservices Architecture' });
28
+ });
29
+
30
+ // TODO: Add service routes here
31
+ // this.app.use('/api/users', require('./services/user-service/src/routes'));
32
+ }
33
+
34
+ start() {
35
+ this.app.listen(this.port, () => {
36
+ console.log(\`🚀 API Gateway running on port \${this.port}\`);
37
+ });
38
+ }
39
+ }
40
+
41
+ const gateway = new ApiGateway();
42
+ gateway.start();
43
+
44
+ module.exports = ApiGateway;
45
+
@@ -0,0 +1,44 @@
1
+ const express = require('express');
2
+ const path = require('path');
3
+ {{#if useDotenv}}
4
+ require('dotenv').config();
5
+ {{/if}}
6
+ {{#if useHelmet}}
7
+ const helmet = require('helmet');
8
+ {{/if}}
9
+
10
+ const app = express();
11
+ const port = process.env.PORT || 3000;
12
+
13
+ const setupMiddleware = () => {
14
+ {{#if useHelmet}}
15
+ app.use(helmet());
16
+ {{/if}}
17
+ app.use(express.json());
18
+ app.use(express.urlencoded({ extended: true }));
19
+ app.use(express.static(path.join(__dirname, 'public')));
20
+ };
21
+
22
+ const setupRoutes = () => {
23
+ app.get('/', (req, res) => {
24
+ res.json({ message: 'Welcome to MVC Application' });
25
+ });
26
+
27
+ // TODO: Add your routes here
28
+ // const userRoutes = require('./src/routes/userRoutes');
29
+ // app.use('/api/users', userRoutes);
30
+ };
31
+
32
+ const start = () => {
33
+ setupMiddleware();
34
+ setupRoutes();
35
+
36
+ app.listen(port, () => {
37
+ console.log(\`🚀 Server running on port \${port}\`);
38
+ });
39
+ };
40
+
41
+ start();
42
+
43
+ module.exports = { app, start };
44
+
@@ -0,0 +1,48 @@
1
+ const express = require('express');
2
+ const path = require('path');
3
+ {{#if useDotenv}}
4
+ require('dotenv').config();
5
+ {{/if}}
6
+ {{#if useHelmet}}
7
+ const helmet = require('helmet');
8
+ {{/if}}
9
+
10
+ class Server {
11
+ constructor() {
12
+ this.app = express();
13
+ this.port = process.env.PORT || 3000;
14
+ this.setupMiddleware();
15
+ this.setupRoutes();
16
+ }
17
+
18
+ setupMiddleware() {
19
+ {{#if useHelmet}}
20
+ this.app.use(helmet());
21
+ {{/if}}
22
+ this.app.use(express.json());
23
+ this.app.use(express.urlencoded({ extended: true }));
24
+ this.app.use(express.static(path.join(__dirname, 'public')));
25
+ }
26
+
27
+ setupRoutes() {
28
+ this.app.get('/', (req, res) => {
29
+ res.json({ message: 'Welcome to MVC Application' });
30
+ });
31
+
32
+ // TODO: Add your routes here
33
+ // const userRoutes = require('./src/routes/userRoutes');
34
+ // this.app.use('/api/users', userRoutes);
35
+ }
36
+
37
+ start() {
38
+ this.app.listen(this.port, () => {
39
+ console.log(\`🚀 Server running on port \${this.port}\`);
40
+ });
41
+ }
42
+ }
43
+
44
+ const server = new Server();
45
+ server.start();
46
+
47
+ module.exports = Server;
48
+
@@ -0,0 +1,42 @@
1
+ const express = require('express');
2
+ {{#if useDotenv}}
3
+ require('dotenv').config();
4
+ {{/if}}
5
+ {{#if useHelmet}}
6
+ const helmet = require('helmet');
7
+ {{/if}}
8
+
9
+ const app = express();
10
+ const port = process.env.PORT || 3000;
11
+
12
+ const setupMiddleware = () => {
13
+ {{#if useHelmet}}
14
+ app.use(helmet());
15
+ {{/if}}
16
+ app.use(express.json());
17
+ app.use(express.urlencoded({ extended: true }));
18
+ };
19
+
20
+ const setupRoutes = () => {
21
+ app.get('/', (req, res) => {
22
+ res.json({ message: 'Welcome to Simple Application' });
23
+ });
24
+
25
+ // TODO: Add your routes here
26
+ // const userRoutes = require('./src/routes/userRoutes');
27
+ // app.use('/api/users', userRoutes);
28
+ };
29
+
30
+ const start = () => {
31
+ setupMiddleware();
32
+ setupRoutes();
33
+
34
+ app.listen(port, () => {
35
+ console.log(\`🚀 Server running on port \${port}\`);
36
+ });
37
+ };
38
+
39
+ start();
40
+
41
+ module.exports = { app, start };
42
+
@@ -0,0 +1,46 @@
1
+ const express = require('express');
2
+ {{#if useDotenv}}
3
+ require('dotenv').config();
4
+ {{/if}}
5
+ {{#if useHelmet}}
6
+ const helmet = require('helmet');
7
+ {{/if}}
8
+
9
+ class Server {
10
+ constructor() {
11
+ this.app = express();
12
+ this.port = process.env.PORT || 3000;
13
+ this.setupMiddleware();
14
+ this.setupRoutes();
15
+ }
16
+
17
+ setupMiddleware() {
18
+ {{#if useHelmet}}
19
+ this.app.use(helmet());
20
+ {{/if}}
21
+ this.app.use(express.json());
22
+ this.app.use(express.urlencoded({ extended: true }));
23
+ }
24
+
25
+ setupRoutes() {
26
+ this.app.get('/', (req, res) => {
27
+ res.json({ message: 'Welcome to Simple Application' });
28
+ });
29
+
30
+ // TODO: Add your routes here
31
+ // const userRoutes = require('./src/routes/userRoutes');
32
+ // this.app.use('/api/users', userRoutes);
33
+ }
34
+
35
+ start() {
36
+ this.app.listen(this.port, () => {
37
+ console.log(\`🚀 Server running on port \${this.port}\`);
38
+ });
39
+ }
40
+ }
41
+
42
+ const server = new Server();
43
+ server.start();
44
+
45
+ module.exports = Server;
46
+
@@ -0,0 +1,121 @@
1
+ {{#if isClass}}
2
+ class {{className}}Service {
3
+ constructor() {
4
+ this.name = '{{name}}';
5
+ }
6
+
7
+ async getAll() {
8
+ try {
9
+ // TODO: Implement get all logic
10
+ return { success: true, data: [] };
11
+ } catch (error) {
12
+ throw error;
13
+ }
14
+ }
15
+
16
+ async getById(id) {
17
+ try {
18
+ // TODO: Implement get by id logic
19
+ return { success: true, data: \`Get {{camelCaseName}} by id: \${id}\` };
20
+ } catch (error) {
21
+ throw error;
22
+ }
23
+ }
24
+
25
+ async create({{camelCaseName}}Data) {
26
+ try {
27
+ // TODO: Implement create logic
28
+ const result = { message: 'Create {{camelCaseName}}', ...{{camelCaseName}}Data };
29
+ return { success: true, data: result };
30
+ } catch (error) {
31
+ throw error;
32
+ }
33
+ }
34
+
35
+ async update(id, {{camelCaseName}}Data) {
36
+ try {
37
+ // TODO: Implement update logic
38
+ const result = { message: \`Update {{camelCaseName}} \${id}\`, ...{{camelCaseName}}Data };
39
+ return { success: true, data: result };
40
+ } catch (error) {
41
+ throw error;
42
+ }
43
+ }
44
+
45
+ async remove(id) {
46
+ try {
47
+ // TODO: Implement delete logic
48
+ return { success: true, data: { message: \`Delete {{camelCaseName}} \${id}\` } };
49
+ } catch (error) {
50
+ throw error;
51
+ }
52
+ }
53
+ }
54
+
55
+ module.exports = {{className}}Service;
56
+ {{else}}
57
+ const execute = async (params) => {
58
+ try {
59
+ // TODO: Implement service logic
60
+ return { success: true, data: '{{className}}Service - execute method' };
61
+ } catch (error) {
62
+ throw error;
63
+ }
64
+ };
65
+
66
+ const getAll = async () => {
67
+ try {
68
+ // TODO: Implement get all logic
69
+ return { success: true, data: [] };
70
+ } catch (error) {
71
+ throw error;
72
+ }
73
+ };
74
+
75
+ const getById = async (id) => {
76
+ try {
77
+ // TODO: Implement get by id logic
78
+ return { success: true, data: \`Get {{camelCaseName}} by id: \${id}\` };
79
+ } catch (error) {
80
+ throw error;
81
+ }
82
+ };
83
+
84
+ const create = async ({{camelCaseName}}Data) => {
85
+ try {
86
+ // TODO: Implement create logic
87
+ const result = { message: 'Create {{camelCaseName}}', ...{{camelCaseName}}Data };
88
+ return { success: true, data: result };
89
+ } catch (error) {
90
+ throw error;
91
+ }
92
+ };
93
+
94
+ const update = async (id, {{camelCaseName}}Data) => {
95
+ try {
96
+ // TODO: Implement update logic
97
+ const result = { message: \`Update {{camelCaseName}} \${id}\`, ...{{camelCaseName}}Data };
98
+ return { success: true, data: result };
99
+ } catch (error) {
100
+ throw error;
101
+ }
102
+ };
103
+
104
+ const remove = async (id) => {
105
+ try {
106
+ // TODO: Implement delete logic
107
+ return { success: true, data: { message: \`Delete {{camelCaseName}} \${id}\` } };
108
+ } catch (error) {
109
+ throw error;
110
+ }
111
+ };
112
+
113
+ module.exports = {
114
+ execute,
115
+ getAll,
116
+ getById,
117
+ create,
118
+ update,
119
+ remove
120
+ };
121
+ {{/if}}
@@ -0,0 +1,39 @@
1
+ {{#if isClass}}
2
+ class {{className}}Util {
3
+ constructor() {
4
+ this.name = '{{name}}';
5
+ }
6
+
7
+ process(data) {
8
+ // TODO: Implement utility function
9
+ return '{{className}}Util - process method';
10
+ }
11
+ }
12
+
13
+ module.exports = {{className}}Util;
14
+ {{else}}
15
+ /**
16
+ * {{className}} utility functions
17
+ */
18
+
19
+ const process = ({{camelCaseName}}Data) => {
20
+ // TODO: Implement utility function
21
+ return '{{className}}Util - process method';
22
+ };
23
+
24
+ const format = (inputData) => {
25
+ // TODO: Implement format function
26
+ return inputData;
27
+ };
28
+
29
+ const validate = ({{camelCaseName}}Data) => {
30
+ // TODO: Implement validate function
31
+ return true;
32
+ };
33
+
34
+ module.exports = {
35
+ process,
36
+ format,
37
+ validate
38
+ };
39
+ {{/if}}