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
<View style={styles.buttonContainer}> | |
<TouchableOpacity onPress={this.takePicture} style={styles.capture}> | |
<Text style={styles.buttonText}> SNAP </Text> | |
</TouchableOpacity> | |
</View> |
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
takePicture = async () => { | |
if (this.camera) { | |
const options = { quality: 0.5, base64: true }; | |
const data = await this.camera.takePictureAsync(options) | |
alert(data.uri); | |
} | |
} |
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 { | |
StyleSheet, | |
Text, | |
TouchableOpacity, | |
View | |
} from 'react-native'; | |
import { RNCamera } from 'react-native-camera'; | |
export default class App extends Component { |
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 express = require('express'); | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
app.use(bodyParser.urlencoded({ extended: false })); | |
app.get('/', (req, res) => { | |
res.send('Hello World!'); | |
}); |
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
module.exports = { | |
username: 'root', | |
password: 'root', | |
database: 'crud_sequelize', | |
host: '127.0.0.1', | |
dialect: 'mysql', | |
} |
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 path = require('path'); | |
module.exports = { | |
'config': path.resolve('config', 'database.js'), | |
'models-path': path.resolve('app', 'models'), | |
'seeders-path': path.resolve('database', 'seeders'), | |
'migrations-path': path.resolve('database', 'migrations'), | |
}; |
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 fs = require('fs'); | |
const path = require('path'); | |
const Sequelize = require('sequelize'); | |
const config = require('../../config/database.js'); | |
const db = {}; | |
const sequelize = new Sequelize(config); | |
fs | |
.readdirSync(__dirname) |
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
module.exports = { | |
up: (queryInterface, DataTypes) => { | |
queryInterface.createTable('Users', { | |
id: { | |
allowNull: false, | |
autoIncrement: true, | |
primaryKey: true, | |
type: DataTypes.INTEGER, | |
}, | |
name: { |
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
module.exports = (sequelize, DataTypes) => { | |
const User = sequelize.define('User', { | |
name: DataTypes.STRING, | |
email: DataTypes.STRING, | |
password: DataTypes.STRING, | |
}); | |
return User; | |
} |
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
app.get('/users', (req, res) => {}); //Listar todos | |
app.post('/users', (req, res) => {}); // Criar | |
app.get('/users/:id', (req, res) => {}); //Buscar | |
app.put('/users/:id', (req, res) => {}); //Editar | |
app.delete('/users/:id', (req, res) => {}); //Deletar |