-
Notifications
You must be signed in to change notification settings - Fork 122
feat: Dart starter #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+121
−0
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # See https://www.dartlang.org/guides/libraries/private-files | ||
|
|
||
| # Files and directories created by pub | ||
| .dart_tool/ | ||
| .packages | ||
| build/ | ||
| # If you're building an application, you may want to check-in your pubspec.lock | ||
| pubspec.lock | ||
|
|
||
| # Directory created by dartdoc | ||
| # If you don't generate documentation locally you can remove this line. | ||
| doc/api/ | ||
|
|
||
| # dotenv environment variables file | ||
| .env* | ||
|
|
||
| # Avoid committing generated Javascript files: | ||
| *.dart.js | ||
| *.info.json # Produced by the --dump-info flag. | ||
| *.js # When generated by dart2js. Don't specify *.js if your | ||
| # project includes source files written in JavaScript. | ||
| *.js_ | ||
| *.js.deps | ||
| *.js.map | ||
|
|
||
| .flutter-plugins | ||
| .flutter-plugins-dependencies |
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,48 @@ | ||
| # ⚡ Dart Starter Function | ||
|
|
||
| A simple starter function. Edit `lib/main.dart` to get started and create something awesome! 🚀 | ||
|
|
||
| ## 🧰 Usage | ||
|
|
||
| ### `GET` | ||
|
|
||
| - Returns a "Hello, World!" message. | ||
|
|
||
| **Response** | ||
|
|
||
| Sample `200` Response: | ||
|
|
||
| ```text | ||
| Hello, World! 🌎 | ||
| ``` | ||
|
|
||
| ### `POST`, `PUT`, `PATCH`, `DELETE` | ||
|
|
||
| - Returns a "Learn More" JSON response. | ||
|
|
||
| **Response** | ||
|
|
||
| Sample `200` Response: | ||
|
|
||
| ```json | ||
| { | ||
| "motto": "Build Fast. Scale Big. All in One Place.", | ||
| "learn": "https://appwrite.io/docs", | ||
| "connect": "https://appwrite.io/discord", | ||
| "getInspired": "https://builtwith.appwrite.io" | ||
| } | ||
| ``` | ||
|
|
||
| ## ⚙️ Configuration | ||
|
|
||
| | Setting | Value | | ||
| |-------------------|-----------------| | ||
| | Runtime | Dart (3.0) | | ||
| | Entrypoint | `lib/main.dart` | | ||
| | Build Commands | `dart pub get` | | ||
| | Permissions | `any` | | ||
| | Timeout (Seconds) | 15 | | ||
|
|
||
| ## 🔒 Environment Variables | ||
|
|
||
| No environment variables required. | ||
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 @@ | ||
| include: package:lints/recommended.yaml |
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,34 @@ | ||
| import 'dart:async'; | ||
| import 'package:dart_appwrite/dart_appwrite.dart'; | ||
|
|
||
| // This is your Appwrite function | ||
| // It's executed each time we get a request | ||
| Future<dynamic> main(final context) async { | ||
| // Why not try the Appwrite SDK? | ||
| // | ||
| // final client = Client() | ||
| // .setEndpoint('https://cloud.appwrite.io/v1') | ||
| // .setProject(process.env.APPWRITE_PROJECT_ID) | ||
| // .setKey(process.env.APPWRITE_API_KEY); | ||
|
|
||
| // You can log messages to the console | ||
| context.log('Hello, Logs! 👋'); | ||
|
|
||
| // If something goes wrong, log an error | ||
| context.error('Hello, Errors! ⛔'); | ||
|
|
||
| // The `req` object contains the request data | ||
| if (context.req.method == 'GET') { | ||
| // Send a response with the res object helpers | ||
| // `res.send()` dispatches a string back to the client | ||
| return context.res.send('Hello, World! 🌎'); | ||
| } | ||
|
|
||
| // `res.json()` is a handy helper for sending JSON | ||
| return context.res.json({ | ||
| 'motto': 'Build Fast. Scale Big. All in One Place.', | ||
| 'learn': 'https://appwrite.io/docs', | ||
| 'connect': 'https://appwrite.io/discord', | ||
| 'getInspired': 'https://builtwith.appwrite.io', | ||
| }); | ||
| } |
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,11 @@ | ||
| name: starter_template | ||
| version: 1.0.0 | ||
|
|
||
| environment: | ||
| sdk: ^3.1.0-edge.3daa47b54e5f39241c44858e0d66ce51723040bf | ||
|
|
||
| dependencies: | ||
| dart_appwrite: ^8.0.1 | ||
|
|
||
| dev_dependencies: | ||
| lints: ^2.0.0 |
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.