Using Moralis on Different Platforms
SERVER_RENDERING variable to prevent warnings at runtime.
To use the npm modules for a browser based application, include it as you normally would:
const Moralis = require('moralis'); // ES6 Minimized import Moralis from 'moralis/dist/moralis.min.js';
For server-side applications or Node.js command line tools, include
// In a node.js environment const Moralis = require('moralis/node');
For React Native applications, include
// In a React Native application const Moralis = require('moralis/react-native.js'); // On React Native >= 0.50 and Moralis >= 1.11.0, set the Async const AsyncStorage = require('react-native').AsyncStorage; Moralis.setAsyncStorage(AsyncStorage);
For WeChat miniprogram, include
// In a WeChat miniprogram const Moralis = require('moralis/weapp');
If you want to use a pre-compiled file, you can fetch it from unpkg. The development version is available at https://unpkg.com/moralis/dist/moralis.weapp.js, and the minified production version is at https://unpkg.com/moralis/dist/moralis.weapp.min.js.
For TypeScript applications, install
$ npm install @types/moralis
Types are updated manually after every release. If a definition doesn't exist, please submit a pull request to [@types/moralis][types-moralis]
3rd Party Authentications
Moralis Server supports many [3rd Party Authenications][3rd-party-auth]. It is possible to [linkWith][link-with] any 3rd Party Authentication by creating a [custom authentication module][custom-auth-module].