为Node.js设计了一个低代码框架,来看看吧
特性
-
让开发人员在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();
左右滑动查看完整代码

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
工作原理
nucleoid.run(() => {var a = 1;var b = a + 2;var c = b + 3;});
状态表
state.a = 1;state.b = state.a + 2;state.c = state.b + 3;

OpenAPI与Nucleoid IDE集成
原文链接:
https://hackernoon.com/nucleoid-a-low-code-framework-for-nodejs
THE END