Skip to content

Instantly share code, notes, and snippets.

View gregfenton's full-sized avatar

Greg Fenton gregfenton

View GitHub Profile
@gregfenton
gregfenton / README.md
Last active March 10, 2023 17:45 — forked from acidtone/README.md
Express: send() vs json() vs end()

Express: res.send() vs res.json() vs res.end()

Materials

Key Takeaways

  • When in doubt, use .send(). It dynamically sets Content-Type headers to match the data it sends.
  • When sending JSON, you can either use .json() or .send().
    • .json() is likely less confusing
    • .json() uses .send() under the hood so the resulting HTTP headers are the same.
@gregfenton
gregfenton / README.md
Last active March 10, 2023 03:33 — forked from acidtone/README.md
Express: Hello World!

Express: Add "Hello World!" API

Prerequisites

  1. Initialized ExpressJS project as per this gist

Example directory structure

project-root
    ├── node_modules
 ├── package-lock.json
@gregfenton
gregfenton / Location Selector
Last active May 2, 2020 20:46 — forked from hanuz06/Location Selector
Location Selector
import React, { useState, useEffect } from "react";
import {
StyleSheet,
Text,
View,
ActivityIndicator,
Alert,
Button,
} from "react-native";
import * as Location from "expo-location";