swagger_ui_darto 0.0.1 copy "swagger_ui_darto: ^0.0.1" to clipboard
swagger_ui_darto: ^0.0.1 copied to clipboard

The Swagger UI Darto is a plugin developed exclusively for the Darto framework.

Swagger UI Darto logo

Swagger UI Darto


🐢🟒 Swagger UI Darto Github
The Swagger UI Darto is a plugin developed exclusively for the Darto framework. It allows you to easily integrate a beautiful Swagger UI into your Darto application, making it simple to visualize your API documentation. This plugin is intended for use with Darto only.


Support πŸ’– #

If you find Swagger UI Darto useful, please consider supporting its development 🌟Buy Me a Coffee🌟. Your support helps improve the framework and make it even better!



Getting Started πŸš€ #

Installation #

Add the following dependencies to your pubspec.yaml:

dependencies:
  swagger_ui_darto: 0.0.1
  darto: latest
  path: latest

Replace latest with the most recent version available.

Usage #

Below is a complete example of how to configure and use Swagger UI Darto in a Darto application with a Todo List API that includes routes for GET, POST, PUT, and DELETE.

import 'dart:io';
import 'package:darto/darto.dart';
import 'package:path/path.dart';
import 'package:swagger_ui_darto/swagger_ui_darto.dart';

void main() {
  final app = Darto();

  // Swagger UI options configuration is optional 🌟
  final options = SwaggerUiOptions(
    title: 'My API Documentation',
    deepLink: true,
    syntaxHighlightTheme: 'monokai',
    persistAuthorization: true,
  );

  // Define the absolute path to the swagger.json file
  final swaggerJsonPath = join(Directory.current.path, 'swagger.json');

  // Mount the Swagger UI router on "/docs"
  // This will set up:
  //   - GET /docs -> Swagger UI HTML page
  //   - GET /docs/swagger.json -> Swagger JSON document
  app.use('/docs', SwaggerUi.serve(swaggerJsonPath, options: options));

  // Your API routes
  // ...

  app.listen(3000, () {
    print('Server running on http://localhost:3000');
    print('Swagger UI available at http://localhost:3000/docs');
  });
}

Example Swagger JSON πŸ“„ #

Create a file named swagger.json at the root of your project with the following document your API like this:

{
  "swagger": "2.0",
  "info": {
    "title": "My API",
    "version": "1.0.0"
  },
  "paths": {}
}

You can use yaml instead of json, just change the extension to .yaml

Official Documentation πŸ“š #

For more details on how to structure your swagger.json, please refer to the Swagger Official Documentation.

License #

This project is licensed under the MIT License.

Have Fun! πŸŽ‰ #

Enjoy building amazing APIs with Darto and the Swagger UI Darto Plugin!


Made by evendersondev with ❀️ for Dart/Flutter developers! 🎯

1
likes
150
points
25
downloads

Publisher

verified publisherevandersondev.com.br

Weekly Downloads

The Swagger UI Darto is a plugin developed exclusively for the Darto framework.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

darto, path

More

Packages that depend on swagger_ui_darto