create-craftjs 2.0.4 → 2.0.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.
package/bin/index.js CHANGED
@@ -81,9 +81,9 @@ const ask = (question) => {
81
81
  }
82
82
 
83
83
  const envContent = `APP_NAME="${projectName}"
84
- APP_SECRET=
84
+ HOST="localhost"
85
85
  BASE_URL="http://localhost:4444"
86
- BASE_API_URL="http://localhost:4444/api"
86
+ APP_SECRET=
87
87
  NODE_ENV="development"
88
88
  TZ="Asia/Jakarta"
89
89
  DATETIME_FORMAT="dd-MM-yyyy HH:mm:ss"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-craftjs",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "A starter kit backend framework powered by Express, TypeScript, EJS Engine, and Prisma — designed for rapid development, simplicity, and scalability.",
5
5
  "bin": {
6
6
  "create-craftjs": "bin/index.js"
@@ -4,5 +4,5 @@ services:
4
4
  image: ${APP_NAME}_image
5
5
  build: .
6
6
  ports:
7
- - "${PORT}:4444"
7
+ - "${PORT}:${PORT}"
8
8
  restart: always
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "craftjs",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "craftjs",
3
3
  "description": "A starter kit backend framework powered by Express, TypeScript, EJS Engine, and Prisma — designed for rapid development, simplicity, and scalability.",
4
- "version": "2.0.4",
4
+ "version": "2.0.5",
5
5
  "keywords": [
6
6
  "express",
7
7
  "typescript",
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import "dotenv/config";
3
3
 
4
4
  const envSchema = z.object({
5
+ HOST: z.string().default("localhost"),
5
6
  APP_NAME: z.string().default("Craft JS"),
6
7
  APP_SECRET: z.string(),
7
8
  NODE_ENV: z
@@ -18,7 +19,6 @@ const envSchema = z.object({
18
19
  DATABASE_NAME: z.string(),
19
20
  DATABASE_CONNECTION_LIMIT: z.coerce.number().default(4444),
20
21
  BASE_URL: z.string().url(),
21
- BASE_API_URL: z.string().url(),
22
22
  CLIENT_URL: z
23
23
  .string()
24
24
  .optional()
@@ -13,6 +13,7 @@ import { setupSwagger } from "@utils/swagger";
13
13
  import { mainRouter } from "@routes/main-route";
14
14
 
15
15
  export const web = express();
16
+ web.set("trust proxy", true);
16
17
  // EJS View Engine Setup
17
18
  // web.set("view engine", "ejs");
18
19
  // web.set("views", path.join(__dirname, "..", "views"));
@@ -33,7 +34,9 @@ web.use(express.static("public"));
33
34
  web.use(httpLogger);
34
35
 
35
36
  // Swagger Setup
36
- setupSwagger(web);
37
+ if (env.NODE_ENV !== "production") {
38
+ setupSwagger(web);
39
+ }
37
40
 
38
41
  // Routes
39
42
  web.use(mainRouter);
@@ -11,9 +11,11 @@ async function startServer() {
11
11
  process.exit(0);
12
12
  }
13
13
  await connectDatabase();
14
- web.listen(env.PORT, () => {
15
- logger.info(`🚀 Server is listening on: ${env.BASE_URL}`);
16
- logger.info(`🔗 API Docs available at: ${env.BASE_API_URL}/docs`);
14
+ web.listen(env.PORT, env.HOST, () => {
15
+ logger.info(`🚀 Server is listening on: http://${env.HOST}:${env.PORT}`);
16
+ logger.info(
17
+ `🔗 API Docs available at: http://${env.HOST}:${env.PORT}/api/docs`
18
+ );
17
19
  });
18
20
  } catch (error) {
19
21
  process.exit(0);
@@ -140,6 +140,9 @@ export function setupSwagger(app: Express) {
140
140
  swaggerUi.setup(swaggerSpec, {
141
141
  customCss: themeCss,
142
142
  customSiteTitle: `${formatAppNameForTitle(env.APP_NAME)} Api Documentation`,
143
+ swaggerOptions: {
144
+ deepLinking: true,
145
+ },
143
146
  })
144
147
  );
145
148
  }