aircodelabs / hydrogen Goto Github PK
View Code? Open in Web Editor NEWThe serverless framework creates web servers that can run anywhere.
Home Page: https://aircode.io
License: MIT License
The serverless framework creates web servers that can run anywhere.
Home Page: https://aircode.io
License: MIT License
已修复
这个aircode 好奇怪, 为啥 npx create-aircode-app 生成的代码并不依赖 aircode, 但是 functions 里的代码还要依赖 const aircode = require("aircode") , 而且把这个依赖去掉也能运行?
Through aircode's upload API, files can be uploaded, but there will be problems with downloading, prompting no such file.
The results are as follows
import aircode from 'aircode';
export default async function (params, content) {
// Get the file from multipart/form-data params, `myFile` is the key
const { _id } = params;
// You can do some permission checks before uploading
// ...
// Upload the file to AirCode
const res = await aircode.files.download({
// Replace the _id value with your file's
_id
});
// return the URL of file
return {
res,
};
}
2023-10-19 Additional information
I still think there is something wrong with using the airecode api for file upload and download in Hydrogen.
If you do not change the data when uploading and saving, only modify the download method as follows
https://github.com/AirCodeLabs/Hydrogen/blob/34d9a016cd7461d4f12ec053399846ad4b925437/src/runtime/file-service.js#L103C7-L103C76
filepath = path.resolve(process.env.AC_FAAS_ROOT, filepath.slice(1));
filepath = process.env.AC_FAAS_ROOT + filepath.slice(2)
这个项目是必须依赖aircode云平台吗还是它是一个类似airecode云平台的开源?
数据库这块按照airecode文档执行的话
import aircode from 'aircode';
export default async function (params, context) {
const dbs = aircode.db.table('persons');
// Use `save` to add a new record
const result = await dbs.save({
name: 'Micheal',
age: 28,
});
// const result = await dbs.where({ name: 'Micheal' }).find();
return {
result
};
};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.