Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ packages:
- "*"
- "packages/*"
- "examples/*"
- "templates/*"

command:
version:
Expand Down
12 changes: 12 additions & 0 deletions templates/crud_rest_api_dartfrog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
node_modules/
npm-debug.log
dist/
.vscode/
.wrangler
.nvim.lua
.idea
*.iml
.dart_tool
.fvm
.dart_frog
3 changes: 3 additions & 0 deletions templates/crud_rest_api_dartfrog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.1.0+1

- TODO: Describe initial release.
1 change: 1 addition & 0 deletions templates/crud_rest_api_dartfrog/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This project is licensed under the MIT License - Copyright Globe.dev
92 changes: 92 additions & 0 deletions templates/crud_rest_api_dartfrog/TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
name: Simple DartFrog Server
description: Building a simple CRUD REST API backend with DartFrog
tags: ["dart", "dartfrog", "globe"]
username: Invertase
---

# 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

```shell
$ globe create -t crud_rest_api_dartfrog
```

#### Start Server

```shell
$ dart_frog dev --port=3000
```

### REST Endpoints

- List Repositories

```shell
curl --request GET --url http://localhost:3000/repos
```

```json
[
{ "id": 0, "name": "express", "url": "github.com/expressjs/express" },
{ "id": 1, "name": "stylus", "url": "github.com/learnboost/stylus" },
{ "id": 2, "name": "cluster", "url": "github.com/learnboost/cluster" }
]
```

- Create New Repository

```shell
curl -X POST -H "Content-Type: application/json" -d '{"name": "java", "url": "java.com/env"}' http://localhost:3000/repos\?username\=jane
Comment thread
codekeyz marked this conversation as resolved.
Outdated
```

```json
[
{ "id": 0, "name": "express", "url": "github.com/expressjs/express" },
{ "id": 1, "name": "stylus", "url": "github.com/learnboost/stylus" },
{ "id": 2, "name": "cluster", "url": "github.com/learnboost/cluster" },
{ "id": 3, "name": "java", "url": "java.com/env" }
Comment thread
codekeyz marked this conversation as resolved.
Outdated
]
```

- Update Repository

```shell
curl -X PUT -H "Content-Type: application/json" -d '{"name": "dart", "url": "dart.dev"}' http://localhost:3000/repos/3\?username\=jane
```

```json
{ "id": 3, "name": "dart", "url": "dart.dev" }
```

- List Repositories for user

```shell
curl --request GET --url http://localhost:3000/repos\?username\=jane
```

```json
[
{ "id": 2, "name": "cluster", "url": "github.com/learnboost/cluster" },
{ "id": 3, "name": "dart", "url": "dart.dev" }
]
```

- Delete Repository for user

```shell
curl --request DELETE --url http://localhost:3000/repos/2\?username\=jane
```

```json
[{ "id": 3, "name": "dart", "url": "dart.dev" }]
```
5 changes: 5 additions & 0 deletions templates/crud_rest_api_dartfrog/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include: package:lints/recommended.yaml

linter:
rules:
file_names: false
9 changes: 9 additions & 0 deletions templates/crud_rest_api_dartfrog/lib/users.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
final users = [
{"name": 'tobi'},
{"name": 'loki'},
{"name": 'jane'}
];

bool userExists(String username) {
Comment thread
codekeyz marked this conversation as resolved.
Outdated
return users.any((user) => user['name'] == username);
}
Loading