API for survey builder
MIT License
Note: Survey Builder is currently hosted on a free server. Please keep in mind that it might take a few minutes to initiate the first time you access it. We appreciate your patience!.
For the corresponding front-end repository, which consumes this API, please visit Survey Builder UI.
This app is also dockerise so after the cloning the repo you can run docker-compose up
to start it and access the api at localhost:3001
. Test it by visiting localhost:3001/heartbeat
.
To set up and run the Survey Builder backend on your local machine, follow these steps:
I've separated the steps for using the app using Docker and running it locally:
To run the Survey Builder backend using Docker, follow these steps:
Clone the Repository: Clone this repository to your local machine using Git.
git clone https://github.com/knowankit/survey-builder.git
cd survey-builder
Build Docker Image: Build the Docker image for the app.
docker-compose build
Start the Docker Containers: Start the app and PostgreSQL database containers.
docker-compose up
Access the API: The app should now be running. You can access the API at http://localhost:3001
.
Test the API: To test if the API is running, you can visit http://localhost:3001/heartbeat
.
To run the Survey Builder backend locally, follow these steps:
Clone the Repository: Clone this repository to your local machine using Git.
git clone https://github.com/knowankit/survey-builder.git
cd survey-builder
Install Dependencies: Install the required Ruby gems using Bundler.
bundle install
Database Setup: Configure your PostgreSQL database credentials in config/database.yml
. Then, create and migrate the database.
rails db:create
rails db:migrate
Start the Server: Launch the Rails server.
rails server
Access the API: The app should now be running. You can access the API at http://localhost:3001
.
Test the API: To test if the API is running, you can visit http://localhost:3001/heartbeat
.
Below is a list of key API endpoints available in the Survey Builder backend:
Endpoint | Method | Description |
---|---|---|
Users | ||
/api/v1/users/register | POST | Register a new user account. |
/api/v1/users/login | POST | Authenticate a user and generate a token. |
/api/v1/users/profile | GET | Retrieve user profile information. |
Surveys | ||
/api/v1/surveys | GET | Get a list of all surveys. |
/api/v1/surveys/:id | GET | Get details of a specific survey. |
/api/v1/surveys | POST | Create a new survey. |
/api/v1/surveys/:id | PUT | Update survey details. |
/api/v1/surveys/:id | DELETE | Delete a survey. |
Questions | ||
/api/v1/questions | GET | Get a list of all questions for a survey. |
/api/v1/questions/:id | GET | Get details of a specific question. |
/api/v1/questions | POST | Create a new question for a survey. |
/api/v1/questions/:id | PUT | Update question details. |
/api/v1/questions/:id | DELETE | Delete a question. |
Question Options | ||
/api/v1/question_options | GET | Get options for a specific question. |
/api/v1/question_options | POST | Add new options to a question. |
/api/v1/question_options/:id | PUT | Update option details. |
/api/v1/question_options/:id | DELETE | Delete an option. |
Responses | ||
/api/v1/responses/:id | GET | Get responses for a specific survey. |
/api/v1/responses | POST | Submit a response for a survey. |
/api/v1/responses | GET | Get all responses |
/heartbeat | GET | Get API running status |
The Survey Builder backend uses PostgreSQL for data storage. Here's an overview of the database structure and key resources:
We welcome contributions from the open-source community! If you're interested in improving the Survey Builder backend, feel free to fork this repository, make your changes, and submit a pull request.
This project is licensed under the MIT License, which grants you the freedom to use, modify, and distribute the software according to the terms specified.
Thank you for your interest in the Survey Builder backend. By collaborating on this project, we aim to empower the development of a robust and feature-rich survey management system. If you have any questions or need assistance, please don't hesitate to reach out to us.