This commit is contained in:
parent
82d65466dd
commit
51785f0853
8 changed files with 247 additions and 2 deletions
|
@ -4,5 +4,9 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: |
|
||||
echo $PWD
|
||||
ls -la
|
||||
npm install
|
||||
npx appwrite client \
|
||||
--endpoint ${{ vars.APPWRITE_ENDPOINT }} \
|
||||
--projectId ${{ vars.APPWRITE_PROJECT_ID }} \
|
||||
--key ${{ secrets.APPWRITE_API_KEY }}
|
||||
npx appwrite deploy function --all
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
node_modules/
|
24
appwrite.json
Normal file
24
appwrite.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"projectId": "66a2d6c20021107d3343",
|
||||
"projectName": "Forgejo Actions Test",
|
||||
"functions": [
|
||||
{
|
||||
"$id": "66a2d6e74666ca0797f7",
|
||||
"name": "demo-web",
|
||||
"runtime": "node-20.0",
|
||||
"execute": [ "any" ],
|
||||
"events": [],
|
||||
"schedule": "",
|
||||
"timeout": 15,
|
||||
"enabled": true,
|
||||
"logging": true,
|
||||
"entrypoint": "src/main.js",
|
||||
"commands": "npm install",
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
".npm"
|
||||
],
|
||||
"path": "functions/demo-web"
|
||||
}
|
||||
]
|
||||
}
|
130
functions/demo-web/.gitignore
vendored
Normal file
130
functions/demo-web/.gitignore
vendored
Normal file
|
@ -0,0 +1,130 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
.cache
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
46
functions/demo-web/README.md
Normal file
46
functions/demo-web/README.md
Normal file
|
@ -0,0 +1,46 @@
|
|||
# demo-web
|
||||
|
||||
## 🧰 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 like a team of hundreds_",
|
||||
"learn": "https://appwrite.io/docs",
|
||||
"connect": "https://appwrite.io/discord",
|
||||
"getInspired": "https://builtwith.appwrite.io"
|
||||
}
|
||||
```
|
||||
|
||||
## ⚙️ Configuration
|
||||
|
||||
| Setting | Value |
|
||||
|-------------------|---------------|
|
||||
| Runtime | Node (20.0) |
|
||||
| Entrypoint | `src/main.js` |
|
||||
| Build Commands | `npm install` |
|
||||
| Permissions | `any` |
|
||||
| Timeout (Seconds) | 15 |
|
||||
|
||||
## 🔒 Environment Variables
|
||||
|
||||
No environment variables required.
|
16
functions/demo-web/package.json
Normal file
16
functions/demo-web/package.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "starter-template",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "src/main.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"format": "prettier --write ."
|
||||
},
|
||||
"dependencies": {
|
||||
"node-appwrite": "^13.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^3.2.5"
|
||||
}
|
||||
}
|
19
functions/demo-web/src/main.js
Normal file
19
functions/demo-web/src/main.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
// This is your Appwrite function
|
||||
// It's executed each time we get a request
|
||||
export default async ({ req, res, log, error }) => {
|
||||
|
||||
// The `req` object contains the request data
|
||||
if (req.method === 'GET') {
|
||||
switch (req.path) {
|
||||
case "/":
|
||||
return res.send('Hello, World!');
|
||||
break;
|
||||
|
||||
default:
|
||||
return res.send("Invalid route", 404)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return res.send("Invalid request", 405)
|
||||
};
|
5
package.json
Normal file
5
package.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"appwrite-cli": "^5.0.5"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue