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
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Skygear + Stripe demo</title> | |
<!--Skygear CDN--> | |
<script src="https://code.skygear.io/js/polyfill/latest/polyfill.min.js"></script> | |
<script src="https://code.skygear.io/js/skygear/latest/skygear.min.js"></script> | |
<script src="https://checkout.stripe.com/checkout.js"></script> | |
<script src="./index_web.js" type="text/javascript"></script> | |
<style> |
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
site: | |
- type: Record | |
name: blogpost | |
label: Blogposts | |
records: | |
blogpost: | |
list: | |
fields: &blogpost_fields | |
- name: id |
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 skygear | |
import stripe | |
import uuid | |
from skygear.container import SkygearContainer | |
from skygear.options import options | |
stripe.api_key = '<your_stripe_api_key>' | |
def getSkygearContainer(): | |
container = SkygearContainer( |
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 { | |
AppRegistry, | |
StyleSheet, | |
TextInput, | |
Text, | |
Keyboard, | |
Button, | |
View, | |
} from 'react-native'; |
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
<html> | |
<head> | |
<script src="https://code.skygear.io/js/polyfill/latest/polyfill.min.js"></script> | |
<script src="https://code.skygear.io/js/skygear/latest/skygear.min.js"></script> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"> | |
</head> | |
<body> | |
<!--Load index.js--> | |
<script type="text/javascript" src="index.js"></script> | |
</body> |
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
document.getElementById("submit-blog-post").addEventListener("submit", (e) => { | |
console.log("form is submitted!"); | |
e.preventDefault(); | |
const title = document.getElementById("title-input").value; | |
const content = document.getElementById("content-input").value; | |
const BlogPost = skygear.Record.extend("blogpost"); | |
const blogpost = new BlogPost ({ | |
"title": title, | |
"content": content |
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 SKYGEAR_ENDPOINT = '<Your Endpoint Here>'; | |
const SKYGEAR_API_KEY = '<Your API Key Here>'; | |
skygear.config({ | |
'endPoint': SKYGEAR_ENDPOINT, | |
'apiKey': SKYGEAR_API_KEY, | |
}).then(() => { | |
console.log("Skygear is running"); | |
return skygear.auth.signupAnonymously(); | |
}).then(() => { |
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 showContent = () => { | |
const BlogPost = skygear.Record.extend("blogpost"); | |
const queryBlogPost = new skygear.Query(BlogPost); | |
queryBlogPost.addDescending('_created_at'); | |
skygear.publicDB.query(queryBlogPost).then((blogpost) => { | |
console.log(blogpost); | |
const list = blogpost.map((blogpost) => { | |
return "<article style='margin-top:40px;'>"+ | |
"<h2>"+blogpost.title+"</h2>"+ |
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
document.getElementById("submit-blog-post").addEventListener("submit", (e) => { | |
console.log("form is submitted!"); | |
e.preventDefault(); | |
const title = document.getElementById("title-input").value; | |
const content = document.getElementById("content-input").value; | |
const BlogPost = skygear.Record.extend("blogpost"); | |
const blogpost = new BlogPost ({ | |
"title": title, | |
"content": content |
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 SKYGEAR_ENDPOINT = '<Your Endpoint Here>'; | |
const SKYGEAR_API_KEY = '<Your API Key Here>'; | |
skygear.config({ | |
'endPoint': SKYGEAR_ENDPOINT, | |
'apiKey': SKYGEAR_API_KEY, | |
}).then(() => { | |
console.log('Skygear container is now ready for making API calls.'); | |
// sign up anonymously after skygear is configured | |
return skygear.auth.signupAnonymously(); |
NewerOlder