Skip to content

Instantly share code, notes, and snippets.

View HigoRibeiro's full-sized avatar
🎯
Focusing

Higo Ribeiro HigoRibeiro

🎯
Focusing
View GitHub Profile
// src/index.js
import Page1 from './Page1';
import Page2 from './Page2';
import { createDrawerNavigator } from 'react-navigation';
const DrawerNavigator = createDrawerNavigator({
Home: Page1,
About: Page2,
const express = require('express');
const app = express();
// Middleware #1
app.get('/', (req, res, next) => {
res.locals.hello = 'Hello World';
next();
});
// Middleware #1
app.use((req, res, next) => {
res.locals.hello = 'Hello World';
next();
});
// Middleware #2
app.get('/', (req, res) => {
return res.send(res.locals.hello);
});
app.use('/app', (req, res, next) => {
if (!usuariologado) {
return res.redirect();
}
next();
});
// Middleware #1
app.use((req, res, next) => {
res.locals.hello = 'Hello World';
next();
});
// Middleware #2
app.get('/', (req, res) => {
return res.send(res.locals.hello);
});
// Middleware #3
app.get('/', (req, res) => {
res.send('Eu nunca serei chamado! T.T');
});
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
ReactDOM.render(<App />, document.getElementById('root'));
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>React + Material | RocketSeat</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body>