Code Monkey home page Code Monkey logo

deno-survey's Introduction

Deno Survey App

Survey application with REST API to manage surveys and questions and website, where all surveys are outputted.

Installation

You need to have deno installed in order to run this application.
Install also denon which watches your file changes and automatically restarts server.

  1. Clone the repository

  2. Go to the project root folder

  3. Copy .env.example into .env file and adjust the values

    # MongoDB connect URI
    MONGODB_URI = mongodb://localhost:27017
    # MondoDB database name
    DB_NAME = deno_survey
    # JWT encryption/decription secret key
    JWT_SECRET_KEY = some-random-key
    # JWT expiration duration
    JWT_EXP_DURATION = 3600000
  4. Run the application by executing

    denon run --allow-net --allow-write --allow-read --allow-env --allow-plugin --unstable server.ts

Usage

In REST API the following endpoints are supported.

METHOD URL Description Request
POST /api/register Register
json
{
  "name": "test",
  "email": "[email protected]",
  "password": "test"
}
            
POST /api/login Login
json
{
  "email": "[email protected]",
  "password": "test"
}
            
GET /api/survey Get surveys for authentication user (Empty)
GET /api/survey/:id Get single survey (Empty)
POST /api/survey Create survey
{
  "name": "Survey name",
  "description": "Survey description"
}
            
PUT /api/survey/:id Update survey
{
  "name": "Survey name",
  "description": "Survey description"
}
DELETE /api/survey/:id Delete survey (Empty)
GET /api/survey/:surveyId/question Get questions for survey (Empty)
GET /api/question/:id Get single question (Empty)
POST /api/question/:surveyId Create question for survey
Single choice question
{
  "text": "How much you liked the Deno Course?",
  "type": "choice",
  "required": true,
  "data": {
    "multiple": false,
    "answers": [
      "I liked it very much",
      "I liked it",
      "I did not like it",
      "I hate it"
    ]
  }
}
Multiple choice question
{
  "text": "Which features do you like in Deno?",
  "type": "choice",
  "required": true,
  "data": {
    "multiple": true,
    "answers": [
      "Typescript",
      "Security",
      "Import from URL",
      "ES6 modules"
    ]
  }
}
Free text question
{
  "text": "Any other comments?",
  "type": "text",
  "required": false
}
PUT /api/question/:id Update question
DELETE /api/question/:id Delete question (Empty)

deno-survey's People

Contributors

thecodeholic avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.