This file contains hidden or 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 app = express() | |
| const port = 3000 | |
| app.get('/somar', (request, response) => { | |
| var num1 = parseFloat(request.query.num1); | |
| var num2 = parseFloat(request.query.num2); | |
| response.send('A soma é: ' + (num1 + num2)); | |
| }) |
This file contains hidden or 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
| function readDirPromise(path) { | |
| const fs = require('fs') | |
| return new Promise((resolve, reject) => { | |
| fs.readdir(path, (err, files) => { | |
| if (err) { | |
| reject(err) | |
| } else { | |
| resolve(files) | |
| } | |
| }) |
This file contains hidden or 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
| function readDirPromise(path) { | |
| const fs = require('fs') | |
| return new Promise((resolve, reject) => { | |
| fs.readdir(path, (err, files) => { | |
| if (err) { | |
| reject(err) | |
| } else { | |
| resolve(files) | |
| } | |
| }) |
This file contains hidden or 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
| function readdirPromise(path) { | |
| const fs = require('fs') | |
| return new Promise((resolve, reject) => { | |
| fs.readdir(path, (err, files) => { | |
| if (err) { | |
| reject(err) | |
| } else { | |
| resolve(files) | |
| } | |
| }) |
This file contains hidden or 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 produtos = [{ | |
| id: 1, | |
| preco: 10.0, | |
| qtd: 2 | |
| }, | |
| { | |
| id: 2, | |
| preco: 10.0, | |
| qtd: 2 | |
| }, |
This file contains hidden or 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 produtos = [{ | |
| nome: 'Bicicleta', | |
| preco: 1200.0 | |
| }, { | |
| nome: 'Capacete', | |
| preco: 450.0 | |
| }] | |
| var apenasPrecos = (produto) => produto.preco; | |
| var soma = (inicio, preco) => inicio + preco; | |
| console.log(produtos.map(apenasPrecos).reduce(soma)); |
This file contains hidden or 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
| var gulp = require('gulp'); | |
| var clean = require('gulp-clean'); | |
| var jshint = require('gulp-jshint'); | |
| var concat = require('gulp-concat'); | |
| var uglify = require('gulp-uglify'); | |
| var imagemin = require('gulp-imagemin'); | |
| var bases = { | |
| app: 'app/', |
This file contains hidden or 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
| 1. Crie uma conta no Digital Ocean; | |
| 2. Crie um droplet Ubuntu (estas instruções são baseadas em Ubuntu) | |
| 3. Escolha o pacote LEMP para ser instalado com seu Ubuntu | |
| 4. Escolha ou associa sua chave publica para acesso ao servidor | |
| 5. Acesse seu server usando SSH (ssh root@<ip informado pelo DO>) |
This file contains hidden or 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
| sudo add-apt-repository ppa:webupd8team/sublime-text-2 | |
| sudo apt-get update | |
| sudo apt-get install sublime-text |
This file contains hidden or 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
| server { | |
| listen 80; | |
| server_name CHANGEME.app; | |
| root /var/www/vhosts/CHANGEME.app/public; | |
| index index.html index.htm index.php; | |
| charset utf-8; | |
| location / { |
NewerOlder