Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question Generator #26

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@ services:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

questiongeneratorservice:
container_name: qgservice-${teamname:-defaultASW}
image: pelazas1/questiongenerator:latest
profiles: ["dev", "prod"]
build: ./game/qgservice
depends_on:
- mongodb
ports:
- "8003:8003"
networks:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb
volumes:
- ./game/qgservice:/usr/src/questiongeneratorservice

gatewayservice:
container_name: gatewayservice-${teamname:-defaultASW}
Expand All @@ -55,6 +71,7 @@ services:
environment:
AUTH_SERVICE_URL: http://authservice:8002
USER_SERVICE_URL: http://userservice:8001
QG_SERVICE_URL: http://qgservice:8003

webapp:
container_name: webapp-${teamname:-defaultASW}
Expand Down
2 changes: 2 additions & 0 deletions game/qgservice/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
coverage
20 changes: 20 additions & 0 deletions game/qgservice/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use an official Node.js runtime as a parent image
FROM node:20

# Set the working directory in the container
WORKDIR /usr/src/questiongeneratorservice

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install app dependencies
RUN npm install

# Copy the app source code to the working directory
COPY . .

# Expose the port the app runs on
EXPOSE 8003

# Define the command to run your app
CMD ["node", "qg-service.js"]
28 changes: 28 additions & 0 deletions game/qgservice/Question4Answers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const mongoose = require('mongoose');

const question4AnswersSchema = new mongoose.Schema({
question: {
type: String,
required: true,
},
correctAnswer: {
type: String,
required: true,
},
incorrectAnswer1: {
type: String,
required: true,
},
incorrectAnswer2: {
type: String,
required: true,
},
incorrectAnswer3: {
type: String,
required: true,
},
});

const Question4Answers = mongoose.model('Question4Answers', question4AnswersSchema);

module.exports = Question4Answers;
Loading