- Initialized
npm
project withpackage.json
file. See: Getting started withnpm
. express
installed as project dependency.- Entry page (i.e.
server.js
) present in the project root.
project-root
npm
project with package.json
file. See: Getting started with npm
.express
installed as project dependency.server.js
) present in the project root.project-root
.send()
. It dynamically sets Content-Type
headers to match the data it sends..json()
or .send()
.
.json()
is likely less confusing.json()
uses .send()
under the hood so the resulting HTTP headers are the same.project-root
├── node_modules
├── package-lock.json
import React, {createContext, useEffect, useState} from 'react'; | |
import auth from '@react-native-firebase/auth'; // or from 'firebase/auth'; | |
import Loading from '../components/Loading'; | |
import {myFirestore} from '../common/firebase.js'; | |
export const AuthContext = createContext({}); | |
export const AuthProvider = (props) => { |
const functions = require('firebase-functions'); | |
const firestore = require('@google-cloud/firestore'); | |
const client = new firestore.v1.FirestoreAdminClient(); | |
// | |
// Add config values with CLI command: | |
// firebase functions:config:set my_app_name='{"fsBackupBucket":"gs://my-fs-backup-bucket"}' | |
// | |
const config = functions.config(); |
import React, {useContext, useState} from 'react'; | |
import {StyleSheet, Dimensions, View, Platform} from 'react-native'; | |
import {List, Button, Text} from 'react-native-paper'; | |
import * as Sentry from '@sentry/react-native'; | |
import * as Updates from 'expo-updates'; | |
import Constants from 'expo-constants'; | |
import { | |
widthPercentageToDP as wPct, |
#!/bin/bash | |
set -e # exit when any command fails | |
function LOG() { | |
printf 'LOG: %s %s\n' "$(date '+%b-%d %T')" "${1}" | |
} | |
function CLONE_GITHUB_REPO() { | |
# | |
# EAS_SCRT_GITHUB_CONFIG_REPOS_TOKEN is an account-level Secret stored in our Expo account's Settings |
import React from "react"; | |
import Login from "../components/Login"; | |
import Landing from "../Pages/Landing"; | |
function Home(props) { | |
const [user, setUser] = useState(); | |
return ( | |
<div> | |
{user ? |
/** | |
* A React component: | |
* r1. name starts with a Capital letter | |
* r2. gets a single argument, typically referred to as "props", that is an object containing all properties passed in | |
* r3. can use hooks (useState, useEffect, useRef, etc...) | |
* r4. returns JSX | |
**/ | |
/** r1. name starts with a Capital letter */ | |
/** r2. gets a single argument, typically named "props" */ |
/** | |
* firestore_add_field_to_all_docs_in_collection.js | |
* | |
* This script is assumed to live in an existing Javascript project that has its own package.json. | |
* I store this script in <PROJECT_ROOT>/tools/cleanup/. | |
* | |
* To use: | |
* 1. Import the 'firebase' and 'esm' NPM modules to your project (Run the command: `npm install firebase esm`) | |
* 2. Edit the data for USER1 and FIREBASE_CONFIG, then adjust parameters in `main` for the call to `visitDocs`. | |
* |