Simple DartFrog Server

Overview

Creating a simple CRUD REST API server. This template helps you to save time to scaffold your Dart backend with DartFrog as quickly as possible.

Getting Started

Bootstrap

Initialize your project using the command below

$ globe create -t crud_rest_api_dartfrog

Start Server

$ dart_frog dev --port=3000

REST Endpoints

  • List Repositories

    curl --request GET --url http://localhost:3000/repos
    
    [
      { "id": 0, "name": "serverpod", "url": "github.com/serverpod/serverpod" },
      { "id": 1, "name": "melos", "url": "github.com/invertase/melos" },
      { "id": 2, "name": "freezed", "url": "github.com/rrousselGit/freezed" }
    ]
    
  • Create New Repository

    curl -X POST -H "Content-Type: application/json" -d '{"name": "java", "url": "java.com/env"}' http://localhost:3000/repos
    
    { "id": 3, "name": "java", "url": "java.com/env" }
    
  • Update Repository

    curl -X PUT -H "Content-Type: application/json" -d '{"name": "dart", "url": "dart.dev"}' http://localhost:3000/repos/3
    
    { "id": 3, "name": "dart", "url": "dart.dev" }
    
  • Delete Repository for user

    curl --request DELETE http://localhost:3000/repos/2
    
    { "message": "Repo 2 successfully deleted." }