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 functions = require("firebase-functions"); | |
const cors = require('cors')({ origin: true }); | |
const admin = require('firebase-admin'); | |
admin.initializeApp(); | |
const database = admin.database().ref('/items'); | |
exports.helloWorld = functions.https.onRequest((request, response) => { | |
response.send("Hello from a Severless Database!"); |
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
exports.getItems = functions.https.onRequest((req, res) => { | |
return cors(req, res, () => { | |
if(req.method !== 'GET') { | |
return res.status(500).json({ | |
message: 'Not allowed' | |
}) | |
} | |
let items = []; |
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 functions = require("firebase-functions"); | |
const cors = require('cors')({ origin: true }); | |
const admin = require('firebase-admin'); | |
admin.initializeApp(); | |
const database = admin.database().ref('/items'); | |
exports.helloWorld = functions.https.onRequest((request, response) => { | |
response.send("Hello from a Severless Database!"); |
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 functions = require("firebase-functions"); | |
const cors = require('cors')({ origin: true }); | |
const admin = require('firebase-admin'); | |
admin.initializeApp(); | |
const database = admin.database().ref('/items'); | |
exports.helloWorld = functions.https.onRequest((request, response) => { |
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 functions = require("firebase-functions"); | |
const cors = require('cors')({ origin: true }); | |
const admin = require('firebase-admin'); | |
admin.initializeApp(); | |
const database = admin.database().ref('/items'); | |
exports.helloWorld = functions.https.onRequest((request, response) => { | |
response.send("Hello from a Severless Database!"); |
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
exports.delete = functions.https.onRequest((req, res) => { | |
return cors(req, res, () => { | |
if(req.method !== 'DELETE') { | |
return res.status(500).json({ | |
message: 'Not allowed' | |
}) | |
} | |
const id = req.query.id | |
admin.database().ref(`/items/${id}`).remove() | |
getItemsFromDatabase(res) |
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 functions = require("firebase-functions"); | |
const cors = require('cors')({ origin: true }); | |
const admin = require('firebase-admin'); | |
admin.initializeApp(); | |
const database = admin.database().ref('/items'); | |
exports.helloWorld = functions.https.onRequest((request, response) => { | |
response.send("Hello from a Severless Database!"); |
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, { Component } from 'react'; | |
import './App.css'; | |
class App extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
buyItems: ['milk', 'bread', 'fruits'], | |
message: '' |
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
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" | |
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous" | |
> |
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
<script | |
src="https://code.jquery.com/jquery-3.2.1.min.js" | |
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" | |
crossorigin="anonymous"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" | |
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" | |
crossorigin="anonymous"></script> |
OlderNewer