this is deta
deta / deta-javascript Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://deta.space/docs/en/reference/base/sdk
License: MIT License
Home Page: https://deta.space/docs/en/reference/base/sdk
License: MIT License
Although the SDK states to have browser support (thus in theory should work with a Worker environment), in real testing, there's a subtle inhibition caused by the reference of the Node.js fs
module when attempting to use deta
in Cloudflare Workers:
% wrangler publish # Cloudflare Workers CLI
....
👀 ./node_modules/deta/dist/index.browser.js
Module not found: Error: Can't resolve 'fs' in './node_modules/deta/dist'
resolve 'fs' in './node_modules/deta/dist'
In order to circumvent the issue (without tinkering with otherwise convoluted webpack configs), I have adapted the deta HTTP APIs using the native Fetch API into a drop-in replacement package https://github.com/woozyking/deta-worker (WIP but also easily dropped once this official SDK supports Worker env properly).
Since this official SDK already uses node-fetch
to bridge the API parity with native web/worker, I think it would be a simple matter of package config (I opted to only use Babel without other packaging utilities) to resolve the fs
issue.
i face with error ReferenceError: globalThis is not when add deta to use deta Base
i using Node js Express in deta Project
but i using DETA BASE for insert and get data
NO ERROR IN CONSOLE TERMINAL but
i SEE ERROR IN BROWSER CONSOLE
like this :
Content Security Policy: The page’s settings blocked the loading of a resource at https://6d91x8.deta.dev/favicon.ico (“default-src”).
my code :
// install express with
npm install express`
const express = require('express')
const app = express()
const deta = require('deta')
const deta = Deta('PRIVATE KEYYY........');
const db = deta.Base('simple_db');
app.get('/', (req, res) => {
db.insert({pesan:"selamat",kelas:2},greting1
)
const item = await db.get('simple_db'); // retrieving item with key "one"
console.log(item)
res.send(JSON.stringify(item))
console.log("123")
res.send("123123")
})
// export 'app'""
module.exports = app`
It would be super cool if we had hooks like in mongoose:
base.pre(
'save',
async data => {
data.password = await hash(data.password, 10);
}
);
I made a simple example, using deta with express.
Now I want to get the ip address from the visitor. I tried some code, but I'm not able to get the ip.
When I run deta visor open
I will also not see the ip of the visitor:
'x-forwarded-for': '99.82.162.217',
'x-forwarded-port': '443',
'x-forwarded-proto': 'https',
'x-real-ip': '99.82.162.217',
Is it possible to get it somehow?
Comments & questions not related to the content of this repo will be deleted.
Hey, I installed the Library / Package and after using it for my Deta Base (which i like it alot), I get
ERROR in ./node_modules/deta/dist/index.browser.js 571:58-89
Module not found: Error: Can't resolve 'fs' in '.../node_modules/deta/dist'
Is there anyway to Fix this?
can I Ignore this Error Somehow?
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.