SDK for using NCMB (Nifukura mobile backend) with Deno

NCMB SDK for deno & TypeScript

SDK for using NCMB (Nifukura mobile backend) with deno. It is an unofficial library. It also works in Node.js x TypeScript environment.

No server development required with mBaaS! | Nifukura mobile backend

How to use

Install deno.

Deno

Sample code

Code to save the object. test.tsPlease save as.

import NCMB from 'https://raw.githubusercontent.com/goofmint/ncmb_deno/master/ncmb.ts'

// If you are a set JSON 
import  {  ReadJson  }  from  'Https://Deno.Land/std/fs/read_json.Ts' 
const  config  =  the await  ReadJson ( './Config.Json' )  the as  {  [ s : string ] : string  } 
const  ApplicationKey  =  config . ApplicationKey 
const  clientKey  =  config . clientKey

// 初期化
const ncmb = new NCMB(applicationKey, clientKey)

// object creation 
Const  Hello  =  Ncmb . Object ( 'HelloDeno' )

// set the value and save 
Await  Hello 
  . Set ( 'Message' ,  'Hello World' ) 
  . Set ( 'Number' ,  100 ) 
  . Save ( )

// if can save object ID is output 
Console . Log ( Hello . Get ( 'objectId' ) )

Execution

--allow-netIs mandatory. --allow-readIs required to read the configuration file.

deno run --allow-net --allow-read test.ts

For Node.js x TypeScript

Install

Do it with npm etc.

npm install ncmb_ts -S

The usage is basically the same, but please note that async/await in the route is not supported.

(async () =>  {
  await hello
    .set('message', 'Hello world')
    .set('number', 100)
    .save()
  console.log(hello.get('objectId'))

  await hello
    .set('number', 200)
    .save()

  console.log(hello.get('number'))

  const query = ncmb.Query('HelloDeno')
  query.equalTo('objectId', 'ypk03ZHeJxjSnSM1')
  query.limit(1)
  const results = await query.fetchAll()
  console.log(results)
})();

Input completion can be used with VS Code etc.

Download Details:

Author: NCMBMania

Demo: https://mbaas.nifcloud.com/

Source Code: https://github.com/NCMBMania/ncmb_deno

#deno #nodejs #node #javascript

SDK for using NCMB (Nifukura mobile backend) with Deno
3.10 GEEK