Skip to content

meztr/deno-survey

 
 

Repository files navigation

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": "test@example.com",
  "password": "test"
}
            
POST /api/login Login
json
{
  "email": "test@example.com",
  "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)

About

Survey Application made with Deno

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 76.2%
  • HTML 22.8%
  • CSS 1.0%