/mc-quiz

Simple quiz game : Validate each answer on server using REST api. Build with NodeJS and Express along with EJS as template engine

Primary LanguageJavaScript

Quiz-game

This is just a simple game

Features and contents

  • The answer is validated in server

  • The poject is very simple and developed for learning

  • Gives a good idea on EJS and EXPRESS

PREVIEW

Preview image

IMPLIMENTATION

As usual at first you need to run node initializing command

  npm install

All the dependecy will be get downloaded

You can start The node server in multiple ways

  npm start

or use

  node index.js

CUSTOMISATON

  quiz: {
        Q1: {
            question: "What is the capital of Kerala ?",
            options: [
                "Aluva",
                "Delhi",
                "Bangaluru",
                "Palakkad",
                "Thiruvanavthapuram"
            ],
            answer: 4
        },
        Q2: {
            question: "Your Question Here",
            options: [
                "options",
                "options",
                "options",
                "options"
            ],
            answer: "Index of answer"
        },
      }

You can add Question's like in the above sample In "db.js"

  • The qustion object must start from Q1 and keep the order like Q1, Q2, Q3... to work properly
  • There is no limit in the number of qustion you can add

If you are into customizing the code it is recommended to use nodemon to make coding easier

You can install nodemon by using following command

  npm install nodemon

And able to run the project by

  nodemon index.js

in some system you need to run it like

  npx nodemon index.js

Explore more and stay creative