SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
Tools & Projects
Dec 2018 Edition
by Jesus Manuel Olivas / weKnow
$ whoami
Jesus Manuel Olivas
jmolivas@weknowinc.com
jmolivas
jmolivas
drupal.org/u/jmolivas
jmolivas.weknowinc.com
Mexicali

Mexico + California
Calexico

California + Mexico
$ ifconfig
weAre
weKnow
weGive
3,300,780
JSON Server
https://github.com/typicode/json-server
Local installation
npm install -g json-server
Create a db.json file with some data
{
"posts": [
{ "id": 1, "title": "Lorem Ipsum", "views": 254, "user_id": 123 },
{ "id": 2, "title": "Sic Dolor amet", "views": 65, "user_id": 456 }
],
"users": [
{ "id": 123, "name": "John Doe" },
{ "id": 456, "name": "Jane Doe" }
],
"comments": [
{ "id": 987, "post_id": 1, "body": "Consectetur adipiscing elit” },
{ "id": 995, "post_id": 1, "body": "Nam molestie pellentesque dui"}
]
}
Start JSON Server
json-server --watch db.json
Resources
* http://localhost:3000/posts
* http://localhost:3000/users
* http://localhost:3000/comments
Home
* http://localhost:3000
Add records using lowDB
curl -X POST "http://localhost:3000/posts" 
-H "accept: application/json" 
-H "Content-Type: application/json" 
-d '{ "title": "Post created from the CLI", "views":100, "user_id":123}'
https://github.com/typicode/lowdb
JSON GraphQL Server
https://github.com/marmelab/json-graphql-server
Local installation
npm install -g json-graphql-server
Create a db.js file with some data
module.exports = {
{
"posts": [
{ "id": 1, "title": "Lorem Ipsum", "views": 254, "user_id": 123 },
{ "id": 2, "title": "Sic Dolor amet", "views": 65, "user_id": 456 }
],
"users": [
{ "id": 123, "name": "John Doe" },
{ "id": 456, "name": "Jane Doe" }
],
"comments": [
{ "id": 987, "post_id": 1, "body": "Consectetur adipiscing elit” },
{ "id": 995, "post_id": 1, "body": "Nam molestie pellentesque dui"}
]
}
}
Start JSON GraphQL Server
{
allPosts {
id
title
User {
id
name
}
}
}
json-graphql-server db.js
react-jsonschema-form
https://github.com/mozilla-services/react-jsonschema-form
Create React App
npx create-react-app my-app
Add react-jsonschema-form dependency
$ npm install react-jsonschema-form --save
Add react-jsonschema-form-semanticui dependency
$ npm install react-jsonschema-form-semanticui —-save
Schema
# forms/todo.js
export const schema = {
title: "Todo Form",
type: "object",
required: ["title"],
properties: {
title: {type: "string", title: "Title", default: "A new task"},
done: {type: "boolean", title: "Done?", default: false}
}
};
Render using ReactJS
import React, { Component } from "react";
import Form from "react-jsonschema-form";
import {schema} from ‘./forms/todo';
const log = (type) => console.log.bind(console, type);
class App extends Component {
render() {
return (
<div className="App">
<Form schema={schema}
onChange={log(“changed")} onSubmit={log(“submitted”) onError={log("errors")} />
</div>
)
}
}
export default App;
Schema + uiSchema + formData
# forms/registration.js
export const schema = {
title: "Todo Form",
type: “object"
}
};
export const uiSchema = {
"firstName": {
"ui:autofocus": true,
"ui:emptyValue": ""
}
}
export const formData = {
"firstName": "Chuck",
"lastName": “Norris"
}
Render using ReactJS
import React,{ Component } from "react";
import Form from "react-jsonschema-form";
import {schema, formData, uiSchema} from './forms/registration';
const log = (type) => console.log.bind(console, type);
class App extends Component {
render() {
return (
<div className="App">
<Form schema={schema} uiSchema={uiSchema} formData={formData}
onChange={log(“changed")} onSubmit={log(“submitted”) onError={log("errors")} />
</div>
)
}
}
export default App;
JSON Schema Resources
> http://json-schema.org
> https://mozilla-services.github.io/react-jsonschema-form
> https://react.semantic-ui.com/layouts/theming
> https://nilportugues.github.io/react-jsonschema-form-semanticui
docz
https://www.docz.site/
Getting Started
mkdir docz
Add dependencies (make sure you add `docz-theme-default`)
yarn add docz
yarn add docz-theme-default
Run it
yarn docz dev
hello-world.mdx
---
name: Hello world
route: /hello-world
---
# Hello world
Hello, I'm a mdx file!
> Lorem ipsum
hello-world-textarea.mdx
—
name: Hello textarea
route: /hello-textarea
---
# Hello world
Hello, I'm still a mdx file, but now I have a textarea element
```
<textarea>
Hello there, this is some text in a text area
</textarea>
```
<textarea>
Hello there, this is some text in a text area
</textarea>
components/Button.mdx
—
name: Button
menu: Components
---
import { Playground, PropsTable } from 'docz'
import { Button } from './Button'
# Button
Buttons make common actions more obvious and help users more easily perform
them. Buttons use labels and sometimes icons to communicate the action that
will occur when the user touches them.
<Button>Click me</Button>
Other tools
Other tools
> https://codesandbox.io
> https://runkit.com
> https://www.prisma.io
> https://code.visualstudio.com
> https://www.netlify.com
Thank you … Questions?

Contenu connexe

Tendances

Getting Started with MongoDB: 4 Application Designs
Getting Started with MongoDB: 4 Application DesignsGetting Started with MongoDB: 4 Application Designs
Getting Started with MongoDB: 4 Application Designs
DATAVERSITY
 
Desenvolvimento web com Ruby on Rails (parte 5)
Desenvolvimento web com Ruby on Rails (parte 5)Desenvolvimento web com Ruby on Rails (parte 5)
Desenvolvimento web com Ruby on Rails (parte 5)
Joao Lucas Santana
 

Tendances (19)

Goa tutorial
Goa tutorialGoa tutorial
Goa tutorial
 
Mongo db for c# developers
Mongo db for c# developersMongo db for c# developers
Mongo db for c# developers
 
Mongo db for C# Developers
Mongo db for C# DevelopersMongo db for C# Developers
Mongo db for C# Developers
 
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDBMongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
 
The Ring programming language version 1.7 book - Part 47 of 196
The Ring programming language version 1.7 book - Part 47 of 196The Ring programming language version 1.7 book - Part 47 of 196
The Ring programming language version 1.7 book - Part 47 of 196
 
Using Change Streams to Keep Up with Your Data
Using Change Streams to Keep Up with Your DataUsing Change Streams to Keep Up with Your Data
Using Change Streams to Keep Up with Your Data
 
Introduction to ECMAScript 2015
Introduction to ECMAScript 2015Introduction to ECMAScript 2015
Introduction to ECMAScript 2015
 
Introduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10genIntroduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10gen
 
JavaScript Promise
JavaScript PromiseJavaScript Promise
JavaScript Promise
 
Getting Started with MongoDB: 4 Application Designs
Getting Started with MongoDB: 4 Application DesignsGetting Started with MongoDB: 4 Application Designs
Getting Started with MongoDB: 4 Application Designs
 
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
 
Do something in 5 with gas 9-copy between databases with oauth2
Do something in 5 with gas 9-copy between databases with oauth2Do something in 5 with gas 9-copy between databases with oauth2
Do something in 5 with gas 9-copy between databases with oauth2
 
jQuery in 15 minutes
jQuery in 15 minutesjQuery in 15 minutes
jQuery in 15 minutes
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web development
 
Desenvolvimento web com Ruby on Rails (parte 5)
Desenvolvimento web com Ruby on Rails (parte 5)Desenvolvimento web com Ruby on Rails (parte 5)
Desenvolvimento web com Ruby on Rails (parte 5)
 
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
 
Html indexed db
Html indexed dbHtml indexed db
Html indexed db
 
Cnam azure 2014 mobile services
Cnam azure 2014   mobile servicesCnam azure 2014   mobile services
Cnam azure 2014 mobile services
 

Similaire à Tools and Projects Dec 2018 Edition

Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
OSCON Byrum
 
前端MVC 豆瓣说
前端MVC 豆瓣说前端MVC 豆瓣说
前端MVC 豆瓣说
Ting Lv
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
Sven Haiges
 

Similaire à Tools and Projects Dec 2018 Edition (20)

Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensions
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
 
GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4GDI Seattle - Intro to JavaScript Class 4
GDI Seattle - Intro to JavaScript Class 4
 
前端MVC 豆瓣说
前端MVC 豆瓣说前端MVC 豆瓣说
前端MVC 豆瓣说
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 
WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
 
SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
第一次用Parse就深入淺出
第一次用Parse就深入淺出第一次用Parse就深入淺出
第一次用Parse就深入淺出
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 
Rails GUI Development with Ext JS
Rails GUI Development with Ext JSRails GUI Development with Ext JS
Rails GUI Development with Ext JS
 
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
 
Rails is not just Ruby
Rails is not just RubyRails is not just Ruby
Rails is not just Ruby
 
Backbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCBackbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVC
 
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptjQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
 
Specification-Driven Development of REST APIs by Alexander Zinchuk
Specification-Driven Development of REST APIs by Alexander Zinchuk   Specification-Driven Development of REST APIs by Alexander Zinchuk
Specification-Driven Development of REST APIs by Alexander Zinchuk
 
Dpilot Source Code With ScreenShots
Dpilot Source Code With ScreenShots Dpilot Source Code With ScreenShots
Dpilot Source Code With ScreenShots
 
Dpilot - Source Code with Snapshots
Dpilot - Source Code with SnapshotsDpilot - Source Code with Snapshots
Dpilot - Source Code with Snapshots
 

Plus de Jesus Manuel Olivas

Plus de Jesus Manuel Olivas (20)

Remix & GraphQL: A match made in heaven with type-safety DX
Remix & GraphQL:  A match made in heaven with type-safety DXRemix & GraphQL:  A match made in heaven with type-safety DX
Remix & GraphQL: A match made in heaven with type-safety DX
 
Drupal 10 Party GraphQL
Drupal 10 Party GraphQLDrupal 10 Party GraphQL
Drupal 10 Party GraphQL
 
How to use Drupal to create editorial experiences your content creators will...
How to use Drupal  to create editorial experiences your content creators will...How to use Drupal  to create editorial experiences your content creators will...
How to use Drupal to create editorial experiences your content creators will...
 
Beyond Static: Building a Dynamic Application with Gatsby
Beyond Static: Building a Dynamic Application with GatsbyBeyond Static: Building a Dynamic Application with Gatsby
Beyond Static: Building a Dynamic Application with Gatsby
 
Drupal, GraphQL, Views, View Modes and Gatsby for a US Gov site CMS Philly
Drupal, GraphQL, Views, View Modes  and Gatsby for a US Gov site CMS PhillyDrupal, GraphQL, Views, View Modes  and Gatsby for a US Gov site CMS Philly
Drupal, GraphQL, Views, View Modes and Gatsby for a US Gov site CMS Philly
 
Embracing the modern web using a Headless CMS with GatsbyJS CMS Philly
Embracing the modern web  using a Headless CMS with GatsbyJS CMS PhillyEmbracing the modern web  using a Headless CMS with GatsbyJS CMS Philly
Embracing the modern web using a Headless CMS with GatsbyJS CMS Philly
 
Embracing the modern web using a Headless CMS with GatsbyJS Stanford
Embracing the modern web using a Headless CMS with GatsbyJS StanfordEmbracing the modern web using a Headless CMS with GatsbyJS Stanford
Embracing the modern web using a Headless CMS with GatsbyJS Stanford
 
Building a modern application using Symfony API Platform and GatsbyJS PHP QRO
Building a modern application using  Symfony API Platform and GatsbyJS PHP QROBuilding a modern application using  Symfony API Platform and GatsbyJS PHP QRO
Building a modern application using Symfony API Platform and GatsbyJS PHP QRO
 
Building a dynamic application with GatsbyJS-Tec-Mexicali
Building a dynamic application  with GatsbyJS-Tec-MexicaliBuilding a dynamic application  with GatsbyJS-Tec-Mexicali
Building a dynamic application with GatsbyJS-Tec-Mexicali
 
Building a modern web application in the cloud partnercon
Building a modern web application in the cloud partnerconBuilding a modern web application in the cloud partnercon
Building a modern web application in the cloud partnercon
 
Embracing the modern web using Drupal as a Headless CMS with Gatsby BADCamp
Embracing the modern web using Drupal as a Headless CMS with Gatsby BADCampEmbracing the modern web using Drupal as a Headless CMS with Gatsby BADCamp
Embracing the modern web using Drupal as a Headless CMS with Gatsby BADCamp
 
Blazing fast sites using Blaze, Hybrid CMS NYC
Blazing fast sites using Blaze, Hybrid CMS NYCBlazing fast sites using Blaze, Hybrid CMS NYC
Blazing fast sites using Blaze, Hybrid CMS NYC
 
Embracing the modern web using Drupal as Headless CMS with GatsbyJS NYC
Embracing the modern web using Drupal as Headless CMS with GatsbyJS NYCEmbracing the modern web using Drupal as Headless CMS with GatsbyJS NYC
Embracing the modern web using Drupal as Headless CMS with GatsbyJS NYC
 
Writing a slack chatbot seattle
Writing a slack chatbot seattleWriting a slack chatbot seattle
Writing a slack chatbot seattle
 
Building a Modern Web Application in the Cloud TecNerd
Building a Modern Web Application in the Cloud TecNerdBuilding a Modern Web Application in the Cloud TecNerd
Building a Modern Web Application in the Cloud TecNerd
 
How to keep Drupal relevant in the Git-based and API-driven CMS era Florida
How to keep Drupal relevant in the Git-based and API-driven CMS era FloridaHow to keep Drupal relevant in the Git-based and API-driven CMS era Florida
How to keep Drupal relevant in the Git-based and API-driven CMS era Florida
 
How to keep Drupal relevant in the Git-based and API-driven CMS era DrupalCampNJ
How to keep Drupal relevant in the Git-based and API-driven CMS era DrupalCampNJHow to keep Drupal relevant in the Git-based and API-driven CMS era DrupalCampNJ
How to keep Drupal relevant in the Git-based and API-driven CMS era DrupalCampNJ
 
Creating a modern web application using Symfony API Platform Atlanta
Creating a modern web application using  Symfony API Platform AtlantaCreating a modern web application using  Symfony API Platform Atlanta
Creating a modern web application using Symfony API Platform Atlanta
 
How to keep Drupal relevant in the Git-based and API-driven CMS era - BADCamp
How to keep Drupal relevant in the Git-based and API-driven CMS era - BADCampHow to keep Drupal relevant in the Git-based and API-driven CMS era - BADCamp
How to keep Drupal relevant in the Git-based and API-driven CMS era - BADCamp
 
Battle of the CMS DrupalCampLA
Battle of the CMS DrupalCampLABattle of the CMS DrupalCampLA
Battle of the CMS DrupalCampLA
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Tools and Projects Dec 2018 Edition

  • 1. Tools & Projects Dec 2018 Edition by Jesus Manuel Olivas / weKnow
  • 2. $ whoami Jesus Manuel Olivas jmolivas@weknowinc.com jmolivas jmolivas drupal.org/u/jmolivas jmolivas.weknowinc.com
  • 8. Local installation npm install -g json-server Create a db.json file with some data { "posts": [ { "id": 1, "title": "Lorem Ipsum", "views": 254, "user_id": 123 }, { "id": 2, "title": "Sic Dolor amet", "views": 65, "user_id": 456 } ], "users": [ { "id": 123, "name": "John Doe" }, { "id": 456, "name": "Jane Doe" } ], "comments": [ { "id": 987, "post_id": 1, "body": "Consectetur adipiscing elit” }, { "id": 995, "post_id": 1, "body": "Nam molestie pellentesque dui"} ] }
  • 9. Start JSON Server json-server --watch db.json Resources * http://localhost:3000/posts * http://localhost:3000/users * http://localhost:3000/comments Home * http://localhost:3000
  • 10. Add records using lowDB curl -X POST "http://localhost:3000/posts" -H "accept: application/json" -H "Content-Type: application/json" -d '{ "title": "Post created from the CLI", "views":100, "user_id":123}' https://github.com/typicode/lowdb
  • 12. Local installation npm install -g json-graphql-server Create a db.js file with some data module.exports = { { "posts": [ { "id": 1, "title": "Lorem Ipsum", "views": 254, "user_id": 123 }, { "id": 2, "title": "Sic Dolor amet", "views": 65, "user_id": 456 } ], "users": [ { "id": 123, "name": "John Doe" }, { "id": 456, "name": "Jane Doe" } ], "comments": [ { "id": 987, "post_id": 1, "body": "Consectetur adipiscing elit” }, { "id": 995, "post_id": 1, "body": "Nam molestie pellentesque dui"} ] } }
  • 13. Start JSON GraphQL Server { allPosts { id title User { id name } } } json-graphql-server db.js
  • 15. Create React App npx create-react-app my-app Add react-jsonschema-form dependency $ npm install react-jsonschema-form --save Add react-jsonschema-form-semanticui dependency $ npm install react-jsonschema-form-semanticui —-save
  • 16. Schema # forms/todo.js export const schema = { title: "Todo Form", type: "object", required: ["title"], properties: { title: {type: "string", title: "Title", default: "A new task"}, done: {type: "boolean", title: "Done?", default: false} } };
  • 17. Render using ReactJS import React, { Component } from "react"; import Form from "react-jsonschema-form"; import {schema} from ‘./forms/todo'; const log = (type) => console.log.bind(console, type); class App extends Component { render() { return ( <div className="App"> <Form schema={schema} onChange={log(“changed")} onSubmit={log(“submitted”) onError={log("errors")} /> </div> ) } } export default App;
  • 18. Schema + uiSchema + formData # forms/registration.js export const schema = { title: "Todo Form", type: “object" } }; export const uiSchema = { "firstName": { "ui:autofocus": true, "ui:emptyValue": "" } } export const formData = { "firstName": "Chuck", "lastName": “Norris" }
  • 19. Render using ReactJS import React,{ Component } from "react"; import Form from "react-jsonschema-form"; import {schema, formData, uiSchema} from './forms/registration'; const log = (type) => console.log.bind(console, type); class App extends Component { render() { return ( <div className="App"> <Form schema={schema} uiSchema={uiSchema} formData={formData} onChange={log(“changed")} onSubmit={log(“submitted”) onError={log("errors")} /> </div> ) } } export default App;
  • 20. JSON Schema Resources > http://json-schema.org > https://mozilla-services.github.io/react-jsonschema-form > https://react.semantic-ui.com/layouts/theming > https://nilportugues.github.io/react-jsonschema-form-semanticui
  • 22. Getting Started mkdir docz Add dependencies (make sure you add `docz-theme-default`) yarn add docz yarn add docz-theme-default Run it yarn docz dev
  • 23. hello-world.mdx --- name: Hello world route: /hello-world --- # Hello world Hello, I'm a mdx file! > Lorem ipsum
  • 24. hello-world-textarea.mdx — name: Hello textarea route: /hello-textarea --- # Hello world Hello, I'm still a mdx file, but now I have a textarea element ``` <textarea> Hello there, this is some text in a text area </textarea> ``` <textarea> Hello there, this is some text in a text area </textarea>
  • 25. components/Button.mdx — name: Button menu: Components --- import { Playground, PropsTable } from 'docz' import { Button } from './Button' # Button Buttons make common actions more obvious and help users more easily perform them. Buttons use labels and sometimes icons to communicate the action that will occur when the user touches them. <Button>Click me</Button>
  • 27. Other tools > https://codesandbox.io > https://runkit.com > https://www.prisma.io > https://code.visualstudio.com > https://www.netlify.com
  • 28. Thank you … Questions?