GithubHelp home page GithubHelp logo

deta-javascript's Introduction

deta

this is deta

deta-javascript's People

Contributors

aavshr avatar abdelhai avatar betahuhn avatar brkp avatar dependabot[bot] avatar henrycunh avatar hozan23 avatar jonasnobile avatar rabingaire avatar webocs avatar xeust avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

deta-javascript's Issues

deta base not work Content Security Policy: The page’s settings blocked the loading of a resource at https://6d91x8.deta.dev/favicon.ico (“default-src”).

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`

Feature request: hooks

It would be super cool if we had hooks like in mongoose:

base.pre(
  'save',
  async data => {
    data.password = await hash(data.password, 10);
  }
);

Service Worker environment (such as Cloudflare Workers) support

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.

get ip from user

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?

Module not found: Error: Can't resolve 'fs'

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.