Skip to content
Snippets Groups Projects
Commit ae22d37e authored by shwtea's avatar shwtea
Browse files

working

parent da17d5e4
Branches
No related tags found
1 merge request!7Shweta working
.env 0 → 100644
NODE_ENV=development
SERVICE_BASE_URL=https://30dd-206-84-239-127.ngrok-free.app
SERVICE_PORT=5000
LOG_LEVEL=debug
...@@ -13,6 +13,11 @@ const WidgetRefSchema = new Schema({ ...@@ -13,6 +13,11 @@ const WidgetRefSchema = new Schema({
const TemplateSchema = new Schema({ const TemplateSchema = new Schema({
name: { type: String, required: true }, name: { type: String, required: true },
desc: { type: String }, desc: { type: String },
platform: {
type: String,
enum: ['web', 'mobile', 'both'],
required: true
},
widgets: [WidgetRefSchema], widgets: [WidgetRefSchema],
hashId: { type: String, unique: true, required: true }, hashId: { type: String, unique: true, required: true },
createdAt: { type: Date, default: Date.now }, createdAt: { type: Date, default: Date.now },
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"body-parser": "^1.20.2", "body-parser": "^1.20.2",
"dotenv": "^16.4.5",
"express": "^4.19.2", "express": "^4.19.2",
"mongoose": "^8.6.0", "mongoose": "^8.6.0",
"nodemon": "^3.1.4", "nodemon": "^3.1.4",
......
// server.js require('dotenv').config();
const express = require('express'); const express = require('express');
const bodyParser = require('body-parser'); const bodyParser = require('body-parser');
const swaggerUi = require('swagger-ui-express'); const swaggerUi = require('swagger-ui-express');
...@@ -19,10 +19,11 @@ app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument)); ...@@ -19,10 +19,11 @@ app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
// API base URL // API base URL
app.use(apiBaseRouter); app.use(apiBaseRouter);
// Start the server // Start the server
const PORT = process.env.PORT || 5000; const PORT = process.env.SERVICE_PORT || 5000;
const BASE_URL = process.env.SERVICE_BASE_URL || `http://localhost:${PORT}`;
app.listen(PORT, () => { app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`); console.log(`Server is running on port ${PORT}`);
console.log(`Swagger UI available at http://localhost:${PORT}/api-docs`); console.log(`Swagger UI available at ${BASE_URL}/api-docs`);
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment