Rank 2: Process
Just copied the util.dart file
Votes
1
Replies
24
Participants
Unknown
Messages
25
Rank 2: Process
Just copied the util.dart file
Rank 2: Process
To my code
Rank 2: Process
And pushed using the CLI
Admin
What's your folder structure and what's the function in your appwrite.json?
Rank 2: Process
Rank 2: Process
"projectId": "64fff1b78429690cbb74", "projectName": "windope", "functions": [ { "$id": "65480141667102a7bf37", "name": "site", "runtime": "dart-2.17", "execute": [], "events": [], "schedule": "", "timeout": 15, "enabled": true, "logging": true, "entrypoint": "lib/main.dart", "commands": "dart pub get", "ignore": [ ".packages", ".dart_tool" ], "path": "./" } ]}Rank 2: Process
final String _dirname = Platform.script.toFilePath();final String staticFolder = '${Uri.file(_dirname).resolve('../static')}';
/// Throws an error if any of the keys are missing from the object/// @param obj - The object to check/// @param keys - The list of keys to check for/// @throws Exceptionvoid throwIfMissing(Map<String, dynamic> obj, List<String> keys) { final missing = <String>[]; for (var key in keys) { if (!obj.containsKey(key) || obj[key] == null) { missing.add(key); } } if (missing.isNotEmpty) { throw Exception('Missing required fields: ${missing.join(', ')}'); }}
/// Returns the contents of a file in the static folder/// @param fileName - The name of the file to read/// @returns Contents of static/{fileName}Future<String> getStaticFile(String fileName) { return File('index.html').readAsString();}Rank 2: Process
even I have done this dart return File('index.html').readAsString();
Admin
Look at the files in the template. The html file should be in a folder named static
Rank 2: Process
yes I have done that only in the begning
Rank 2: Process
still same error
Admin
What?
Rank 2: Process
return File('index.html').readAsString();}``` have hardcored the file pathAdmin
Have you tried doing it as the template does?
Rank 2: Process
In the starting I have followed the same file structure
Rank 2: Process
Yes I have
Rank 2: Process
getting the same error
Admin
Please share what you have after you change it to what the template did
Rank 2: Process
its simply serves a index.html on GET at /
Rank 2: Process
Admin
hmm odd...let me check with the team
Rank 2: Process
yes I am contributing to appwrite/template ,
Rank 2: Process
pull request just pending on this @Drake
Admin
For now, you might want to put a string in your code rather than trying to have a static file
I'm experiencing the same problem. any solution?
Error:- PathNotFoundException: Cannot open file, path = 'file:///usr/local/server/src/static/index.html' (OS Error: No such file or directory, errno = 2)