mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-01 07:09:43 -06:00
move to src
This commit is contained in:
@@ -10,4 +10,4 @@ COPY ./server/ ./
|
||||
|
||||
EXPOSE 52345
|
||||
|
||||
CMD ["node", "index.js"]
|
||||
CMD ["node", "src/index.js"]
|
||||
@@ -22,4 +22,4 @@ RUN chmod +x ./scripts/inject-vars.sh
|
||||
|
||||
EXPOSE 52345
|
||||
|
||||
CMD ./scripts/inject-vars.sh && node ./index.js
|
||||
CMD ./scripts/inject-vars.sh && node ./src/index.js
|
||||
|
||||
@@ -22,4 +22,4 @@ RUN chmod +x ./scripts/inject-vars.sh
|
||||
|
||||
EXPOSE 52345
|
||||
|
||||
CMD ./scripts/inject-vars.sh && node ./index.js
|
||||
CMD ./scripts/inject-vars.sh && node ./src/index.js
|
||||
|
||||
4
docker/dist/build_images.sh
vendored
4
docker/dist/build_images.sh
vendored
@@ -12,10 +12,10 @@ declare -A services=(
|
||||
)
|
||||
|
||||
for service in "${!services[@]}"; do
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
docker build \
|
||||
-f "${services[$service]}" \
|
||||
-t "$service" \
|
||||
.
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error building $service image. Exiting..."
|
||||
|
||||
2
docker/dist/server.Dockerfile
vendored
2
docker/dist/server.Dockerfile
vendored
@@ -10,4 +10,4 @@ COPY ./server/ ./
|
||||
|
||||
EXPOSE 52345
|
||||
|
||||
CMD ["node", "index.js"]
|
||||
CMD ["node", "src/index.js"]
|
||||
@@ -12,4 +12,4 @@ COPY ./server ./
|
||||
|
||||
EXPOSE 52345
|
||||
|
||||
CMD ["node", "index.js"]
|
||||
CMD ["node", "src/index.js"]
|
||||
@@ -12,4 +12,4 @@ COPY ./server ./
|
||||
|
||||
EXPOSE 52345
|
||||
|
||||
CMD ["node", "index.js"]
|
||||
CMD ["node", "src/index.js"]
|
||||
10
server/index.js
Executable file → Normal file
10
server/index.js
Executable file → Normal file
@@ -1,14 +1,14 @@
|
||||
import { initializeServices } from "./config/services.js";
|
||||
import { initializeControllers } from "./config/controllers.js";
|
||||
import { createApp } from "./app.js";
|
||||
import { initializeServices } from "./src/config/services.js";
|
||||
import { initializeControllers } from "./src/config/controllers.js";
|
||||
import { createApp } from "./src/app.js";
|
||||
import { initShutdownListener } from "./shutdown.js";
|
||||
import logger from "./utils/logger.js";
|
||||
import { fileURLToPath } from "url";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
import SettingsService from "./service/system/settingsService.js";
|
||||
import AppSettings from "./db/models/AppSettings.js";
|
||||
import SettingsService from "./src/service/system/settingsService.js";
|
||||
import AppSettings from "./src/db/models/AppSettings.js";
|
||||
|
||||
const SERVICE_NAME = "Server";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ignore": ["locales/*", "*.log", "node_modules/*"],
|
||||
"watch": ["*.js", "*.json"],
|
||||
"ignore": ["src/locales/*", "*.log", "node_modules/*"],
|
||||
"watch": ["src/**/*.js", "*.json"],
|
||||
"ext": "js,json"
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "c8 mocha",
|
||||
"dev": "nodemon index.js",
|
||||
"dev": "nodemon src/index.js",
|
||||
"lint": "eslint .",
|
||||
"lint-fix": "eslint --fix .",
|
||||
"format": "prettier --write .",
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export const startServer = () => {};
|
||||
@@ -1,7 +1,5 @@
|
||||
import mongoose from "mongoose";
|
||||
import { BaseCheckSchema } from "./Check.js";
|
||||
import logger from "../../utils/logger.js";
|
||||
import { time } from "console";
|
||||
const AuditSchema = mongoose.Schema({
|
||||
id: { type: String, required: true },
|
||||
title: { type: String, required: true },
|
||||
55
server/src/index.js
Executable file
55
server/src/index.js
Executable file
@@ -0,0 +1,55 @@
|
||||
import { initializeServices } from "./config/services.js";
|
||||
import { initializeControllers } from "./config/controllers.js";
|
||||
import { createApp } from "./app.js";
|
||||
import { initShutdownListener } from "./shutdown.js";
|
||||
import logger from "./utils/logger.js";
|
||||
import { fileURLToPath } from "url";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
import SettingsService from "./service/system/settingsService.js";
|
||||
import AppSettings from "./db/models/AppSettings.js";
|
||||
|
||||
const SERVICE_NAME = "Server";
|
||||
|
||||
const startApp = async () => {
|
||||
// FE path
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const openApiSpec = JSON.parse(fs.readFileSync(path.join(__dirname, "../openapi.json"), "utf8"));
|
||||
const frontendPath = path.join(__dirname, "public");
|
||||
// Create services
|
||||
const settingsService = new SettingsService(AppSettings);
|
||||
const appSettings = settingsService.loadSettings();
|
||||
|
||||
// Initialize services
|
||||
const services = await initializeServices(appSettings, settingsService);
|
||||
|
||||
// Initialize controllers
|
||||
const controllers = initializeControllers(services);
|
||||
|
||||
const app = createApp({
|
||||
services,
|
||||
controllers,
|
||||
appSettings,
|
||||
frontendPath,
|
||||
openApiSpec,
|
||||
});
|
||||
|
||||
const port = appSettings.port || 52345;
|
||||
const server = app.listen(port, () => {
|
||||
logger.info({ message: `Server started on port:${port}` });
|
||||
});
|
||||
|
||||
initShutdownListener(server, services);
|
||||
};
|
||||
|
||||
startApp().catch((error) => {
|
||||
logger.error({
|
||||
message: error.message,
|
||||
service: SERVICE_NAME,
|
||||
method: "startApp",
|
||||
stack: error.stack,
|
||||
});
|
||||
process.exit(1);
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user