This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Text } from "react-native"; | |
import * as Device from "expo-device"; | |
import * as Notifications from "expo-notifications"; | |
Notifications.setNotificationHandler({ | |
handleNotification: async () => ({ | |
shouldShowAlert: true, | |
shouldPlaySound: true, | |
shouldSetBadge: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FirebaseAdmin from "firebase-admin" | |
const usersNotificationTokens = ["..."] | |
const serviceAccount = await import("./firebase.json"); | |
FirebaseAdmin.initializeApp({ | |
credential: FirebaseAdmin.credential.cert({ | |
projectId: serviceAccount.project_id, | |
clientEmail: serviceAccount.client_email, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Backend with Node.JS | |
import { OAuth2Client } from "google-auth-library"; | |
const googleAuthentication = async (response: any) => { | |
const { credential } = response; | |
const client = new OAuth2Client(process.env.GOOGLE_CLIENT_ID); | |
const ticket = await client.verifyIdToken({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 0.2 | |
phases: | |
install: | |
runtime-versions: | |
nodejs: latest | |
commands: | |
- npm install -g yarn typescript | |
- yarn install | |
build: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async getAll(pagination: PaginationInput) { | |
/* Note: | |
* - if sorting in descending order then use $lt | |
* - if sorting in ascending order then use $gt | |
*/ | |
const { limit = 5, next } = pagination; | |
var query = {}; | |
const total = await User.countDocuments(query); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { createAdapter } = require("@socket.io/mongo-adapter"); | |
const MONGODB_URI = "mongodb://localhost:27017/app"; | |
const params = { | |
useNewUrlParser: true, | |
useUnifiedTopology: true | |
}; | |
mongoose.connect(MONGODB_URI, params, async (err, data) => { | |
if (err) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require("aws-sdk"); | |
const { nanoid } = require("nanoid"); | |
const { AWS_S3_BUCKET, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY } = require("./config"); | |
class AWSUtil { | |
constructor() { | |
this.s3 = new AWS.S3({ | |
accessKeyId: AWS_ACCESS_KEY_ID, | |
secretAccessKey: AWS_SECRET_ACCESS_KEY | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Node Class | |
class Node { | |
constructor(data, next = null) { | |
this.data = data; | |
this.next = next; | |
} | |
} | |
// Linked List Class | |
class LinkedList { |