This repository was archived by the owner on Apr 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
feat: Add Simple DartFrog Rest-API Template #79
Merged
Merged
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
2703c6a
move all templates to public repository
mhadaily cd6a385
update templates
mhadaily aa8bbdc
restructure folders
mhadaily ef9c483
fix docker file
mhadaily 2dd8cf7
fix folders
mhadaily 5519ea8
change all default to true
mhadaily 192213b
add more to the template
mhadaily 60a3ee6
remove other templates
codekeyz f8d08d5
wip
codekeyz 015fbad
simple dart frog template
codekeyz dc77abb
add tests
codekeyz b364bee
wip
codekeyz fa95767
resolve linter issues
codekeyz ffa4623
fix analysis issue
codekeyz 852fa02
rework simple dart frog template
codekeyz a09a1be
rework simple dart-frog example
codekeyz fc5745c
improve simple dart-frog example
codekeyz 1910f0b
tiny fix
codekeyz 1839047
misc
codekeyz e9cd264
specify collection package version
codekeyz de10100
rename template
codekeyz f2d49f5
restructure code
codekeyz 1215e6a
update template doc
codekeyz 35adab5
_
codekeyz a9d17e2
_
codekeyz a4740f2
fix template doc
codekeyz e55978d
simplify template
codekeyz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ packages: | |
| - "*" | ||
| - "packages/*" | ||
| - "examples/*" | ||
| - "templates/*" | ||
|
|
||
| command: | ||
| version: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # 0.1.0+1 | ||
|
|
||
| - TODO: Describe initial release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| This project is licensed under the MIT License - Copyright Globe.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| ``` | ||
|
|
||
| ```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" } | ||
|
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" }] | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| include: package:lints/recommended.yaml | ||
|
|
||
| linter: | ||
| rules: | ||
| file_names: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { | ||
|
codekeyz marked this conversation as resolved.
Outdated
|
||
| return users.any((user) => user['name'] == username); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.