Cricks API is a robust and secure web application built with .NET 8.0, providing cricket match scoring and management. It uses Entity Framework Core for data storage and JWT for authentication.
- JWT Authentication: Secure authentication using JSON Web Tokens.
- Role-based Authorization: Access control with predefined user roles.
- Entity Framework Core: Support for multiple databases including SQLite, SQL Server, MySQL, and PostgreSQL.
- Swagger UI: Interactive API documentation and testing.
-
GET /matches
: Returns a list of cricket matches. -
GET /matches/{id}
: Returns a specific cricket match by ID. -
POST /matches
: Creates a new cricket match. -
PUT /matches/{id}
: Updates an existing cricket match. -
DELETE /matches/{id}
: Deletes a cricket match. -
GET /tournament
: Returns a list of tournaments. -
GET /tournament/{id}
: Returns a specific tournament by ID. -
POST /tournament
: Creates a new tournament. -
PUT /tournament/{id}
: Updates an existing tournament. -
DELETE /tournament/{id}
: Deletes a tournament. -
GET /ball
: Returns a list of balls. -
GET /ball/{id}
: Returns a specific ball by ID. -
POST /ball
: Creates a new ball. -
PUT /ball/{id}
: Updates an existing ball. -
DELETE /ball/{id}
: Deletes a ball.
- .NET 8.0 or later
- SQLite, SQL Server, MySQL, or PostgreSQL
- Clone the repository
- Navigate to the project directory
- Restore the packages
- Run the application
Once the application is running, you can access the Swagger UI at http://localhost:5000/swagger
.
Contributions, issues, and feature requests are welcome! Feel free to check issues page. You can also take a look at the contributing guide.
This project is MIT licensed.
Created by @atiproy - feel free to contact me!
The MatchesController
is an API controller that provides cricket match management. It has the following methods:
GET /matches
: Returns a list of cricket matches.GET /matches/{id}
: Returns a specific cricket match by ID.POST /matches
: Creates a new cricket match.PUT /matches/{id}
: Updates an existing cricket match.DELETE /matches/{id}
: Deletes a cricket match.
The TournamentController
is an API controller that provides tournament management. It has the following methods:
GET /tournament
: Returns a list of tournaments.GET /tournament/{id}
: Returns a specific tournament by ID.POST /tournament
: Creates a new tournament.PUT /tournament/{id}
: Updates an existing tournament.DELETE /tournament/{id}
: Deletes a tournament.
The BallController
is an API controller that provides ball management. It has the following methods:
GET /ball
: Returns a list of balls.GET /ball/{id}
: Returns a specific ball by ID.POST /ball
: Creates a new ball.PUT /ball/{id}
: Updates an existing ball.DELETE /ball/{id}
: Deletes a ball.
The application uses JWT for authentication. The JWT is included in the Authorization
header with the Bearer
scheme.
The application uses role-based authorization. The TournamentController
requires the user to have the "Owner" role.
The application uses Entity Framework Core for data storage. The connection string is configured in the appsettings.json
file. It supports multiple databases including SQLite, SQL Server, MySQL, and PostgreSQL.
The application includes Swagger UI for interactive API documentation and testing. You can access it at http://localhost:5000/swagger
when the application is running.