Skip to content

Instantly share code, notes, and snippets.

// Import Apollo Azure integration library
const { ApolloServer, gql } = require('apollo-server-azure-functions');
const { CosmosClient } = require('@azure/cosmos');
// Add correct values to each variable
const connectionString = "ADD_CONNECTION_STRING";
const databaseName = "ADD_DATABASE_NAME";
const containerName = "ADD_CONTAINER_NAME";
// Create connection to Cosmo DB
@shamique
shamique / graphql_helloworld.js
Created January 9, 2021 15:53
GraphQL_Serverless_API
// Import Apollo Azure integration library
const { ApolloServer, gql } = require('apollo-server-azure-functions');
// Construct a schema, using GraphQL schema language
const typeDefs = gql`
type Query {
hello: String
}
`;
var expect = require('chai').expect;
describe('Simple App testing', () => {
// Adding time out to make sure the app is load prior to test is run
beforeEach(() => {
$("~app-root").waitForDisplayed(11000, false)
});
it('Valid Login Test', async => {
import React, { Component } from 'react';
import { TouchableHighlight, StyleSheet, Text, TextInput, View } from 'react-native';
export default class App extends Component {
constructor() {
super()
this.state = {
username: '',
password: '',
isLogined: false
var actualPassword = [],
temperoryPassword,
currentCursorPosition = 0,
passwordChar = '•';
$("#password-text").bind("input", function () {
temperoryPassword = $(this).val();
var passwordLength = temperoryPassword.length;
for (var i = 0; i < passwordLength; i++) {
<ion-header hideBackButton="true">
<ion-navbar>
<ion-title>Upload Image</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<img [src]="imageView" *ngIf="imageView" />
<ion-row>
<ion-col>
uploadPhoto() {
let loading = this.loader.create({
title: 'Wait',
subTitle: 'Uploading...'
});
loading.present();
this.cognitoService
.getLoggedUser()
.then(userToken => {
openCamera() {
this.platform.ready().then(readySource => {
const options: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
};
this.camera.getPicture(options).then(
upload(image, imageName, accessToken) {
return new Promise((resolve, reject) => {
aws.config.region = this.SYSTEM_VARIABLE.REGION;
aws.config.credentials = new aws.CognitoIdentityCredentials({
IdentityPoolId: this.SYSTEM_VARIABLE.COGNITO_IDENTITY.IDENTITY_POOL_ID,
Logins: {
"cognito-idp.<REGION_NAME>.amazonaws.com/<USER_POOL_ID>": accessToken
}
});
import { Component } from "@angular/core";
import { NavController, NavParams, LoadingController } from "ionic-angular";
import { CognitoServiceProvider } from "../../providers/cognito-service/cognito-service";
import { SignUpPage } from "../../pages/sign-up/sign-up";
import { ImageUploadPage } from "../../pages/image-upload/image-upload";
@Component({
selector: "page-login",
templateUrl: "login.html"
})