文章源自菜鸟学院-https://www.cainiaoxueyuan.com/gcs/28463.html
特性
让开发人员在AI的帮助下构建API(大量的图)
在底层声明性运行时环境中使用
运行时环境内置有数据存储
Hello World
> npm i nucleoidjs
const nucleoid = require("nucleoidjs");const app = nucleoid();class User { constructor(name) { this.name = name; }}// ? This is it!app.post("/users", () => { new User("Daphne");});app.listen(3000);
理论
CRUD
快速设置
const nucleoid = require("nucleoidjs"); // npm install nucleoidjsconst app = nucleoid();
左右滑动查看完整代码文章源自菜鸟学院-https://www.cainiaoxueyuan.com/gcs/28463.html
Create
class User {constructor(name) {this.name = name;}}nucleoid.register(User);app.post("/users", (req) => {const name = req.body.name;return new User(name);});
Read
app.get("/users/:id", (req) => {const id = req.params.id;return User[id];});
Update & Delete
app.post("/users/:id", (req) => {const id = req.params.id;const name = req.body.name;const user = User[id];if (user) {user.name = name;return user;}});app.delete("/users/:id", (req) => {const id = req.params.id;delete User[id];})
Query
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/gcs/28463.html
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/gcs/28463.html
工作原理
nucleoid.run(() => {var a = 1;var b = a + 2;var c = b + 3;});
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/gcs/28463.html
状态表文章源自菜鸟学院-https://www.cainiaoxueyuan.com/gcs/28463.htmlstate.a = 1;state.b = state.a + 2;state.c = state.b + 3;
OpenAPI与Nucleoid IDE集成
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/gcs/28463.html
原文链接:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/gcs/28463.html
https://hackernoon.com/nucleoid-a-low-code-framework-for-nodejs文章源自菜鸟学院-https://www.cainiaoxueyuan.com/gcs/28463.html