BanqServer is a backend API designed for managing question banks within an educational environment. It provides a scalable and secure way for schools to manage question storage, retrieval, and organization. This API is built with ASP.NET Core, following clean architecture principles, and includes support for Docker deployment.
- Features
- Project Structure
- Setup and Installation
- Configuration
- API Endpoints
- Authentication
- Docker Support
- Contributing
- License
- Question Management: CRUD operations for creating, retrieving, updating, and deleting questions.
- User Authentication: Secured endpoints for user access and role management.
- Database Migrations: Integrated migrations for database setup and updates.
- Docker Support: Easily deployable via Docker for consistent production and development environments.
The project is structured as follows:
BanqServer/
├── Authentication/ # Authentication logic and user management
├── Controllers/ # API endpoints
├── DTOs/ # Data Transfer Objects for data shaping
├── Database/ # Database setup and configuration
├── Extensions/ # Extension methods
├── Migrations/ # Database migrations
├── Utilities/ # Helper functions
├── ViewModels/ # Models for API responses
├── appsettings.json # Application configuration
├── Dockerfile # Docker configuration
├── Banq.csproj # Project configuration and dependencies
└── Program.cs # Main entry point of the application
-
Clone the Repository:
git clone https://github.com/yourusername/BanqServer.git cd BanqServer -
Restore Dependencies: Use the following command to install the required packages:
dotnet restore
-
Apply Database Migrations: Ensure the database is set up by applying migrations:
dotnet ef database update
-
Run the Application: Start the server with:
dotnet run
The server will run on http://localhost:5000 by default.
BanqServer uses appsettings.json for configuration management. Adjust the database connection strings and other settings as necessary for your environment.
appsettings.json: Main configuration file.appsettings.Development.json: Configuration overrides for development.
The following are key API endpoints for managing questions:
| Endpoint | Method | Description |
|---|---|---|
/api/questions |
GET | Retrieve all questions |
/api/questions/{id} |
GET | Retrieve a question by ID |
/api/questions |
POST | Create a new question |
/api/questions/{id} |
PUT | Update a question |
/api/questions/{id} |
DELETE | Delete a question |
Detailed API documentation is available via Swagger at http://localhost:5000/swagger.
BanqServer includes authentication and role-based access to restrict access to certain endpoints. Authentication is implemented in the Authentication folder and configured in appsettings.json.
To build and run BanqServer using Docker:
-
Build the Docker Image:
docker build -t banqserver . -
Run the Docker Container:
docker run -p 5000:5000 banqserver
