Initial Commit

This commit is contained in:
2025-01-27 04:51:08 +00:00
commit f1dae61ef4
11 changed files with 311 additions and 0 deletions
@@ -0,0 +1,30 @@
# 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
# Directory used by Appwrite CLI for local development
.appwrite
+46
View File
@@ -0,0 +1,46 @@
# mesaages_upd_function
## 🧰 Usage
### GET /ping
- Returns a "Pong" message.
**Response**
Sample `200` Response:
```text
Pong
```
### GET, POST, PUT, PATCH, DELETE /
- Returns a "Learn More" JSON response.
**Response**
Sample `200` Response:
```json
{
"motto": "Build like a team of hundreds_",
"learn": "https://appwrite.io/docs",
"connect": "https://appwrite.io/discord",
"getInspired": "https://builtwith.appwrite.io"
}
```
## ⚙️ Configuration
| Setting | Value |
| ----------------- | --------------- |
| Runtime | Dart (2.17) |
| Entrypoint | `lib/main.dart` |
| Build Commands | `dart pub get` |
| Permissions | `any` |
| Timeout (Seconds) | 15 |
## 🔒 Environment Variables
No environment variables required.
@@ -0,0 +1 @@
include: package:lints/recommended.yaml
@@ -0,0 +1,28 @@
import 'dart:async';
import 'dart:io';
import 'package:dart_appwrite/dart_appwrite.dart';
late Databases _database;
var _usersDbId;
var _conversationDbId;
var _documentId;
var _databaseId;
Future<dynamic> main(final context) async {
try {
final client = Client()
.setEndpoint(
Platform.environment['APPWRITE_FUNCTION_API_ENDPOINT'] ?? '')
.setProject(Platform.environment['APPWRITE_FUNCTION_PROJECT_ID'] ?? '')
.setKey(context.req.headers['x-appwrite-key'] ?? '');
_database = Databases(client);
} on AppwriteException catch (e) {
context.error('error message - ${e.message}');
} on Exception catch (e) {
context.error('error message - ${e.toString()}');
}
return context.res.empty();
}
@@ -0,0 +1,11 @@
name: starter_template
version: 1.0.0
environment:
sdk: ^2.17.0
dependencies:
dart_appwrite: 8.0.0
dev_dependencies:
lints: ^2.0.0