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) => { | |
let soma = (parseInt(request.query.num1) + parseInt(request.query.num2)) | |
response.end(`A soma é ${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
const fs = require('fs') | |
const path = './' | |
function readdirPromise(path) { | |
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 fs = require('fs') | |
const path = './' | |
function readdirPromise(path) { | |
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 fs = require('fs') | |
const path = './' | |
function readdirPromise(path) { | |
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 | |
} | |
] |
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
module.exports = function(grunt) { | |
grunt.initConfig({ | |
clean: { | |
temp: [ | |
'public/js/app.js', | |
'public/js/libs.js' | |
], | |
all: [ | |
'public/js/*.js' |
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
// multpart/data | |
$('form').on('submit', function (e) { | |
e.preventDefault(); | |
var form = new FormData($(this)[0]); | |
$.ajax({ | |
method: "POST", | |
url: URL, | |
data: form, | |
processData: false, | |
contentType: false, |
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
public IQueryable<AlunoDto> BuscarTodosAlunoDtos() | |
{ | |
var alunos = ( | |
from al in _context.Alunos | |
join pe in _context.Pessoas on al.Id equals pe.Id | |
into alu | |
from alun in alu.DefaultIfEmpty() | |
join at in _context.AlunoTurmas on al.Id equals at.AlunoId into alt | |
from ats in alt.DefaultIfEmpty() |
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
namespace Dominio { | |
public class Aluno | |
{ | |
public Aluno( string nome, string matricula, string sexo, DateTime dataNascimento, string cpf, string corRaca, string email) | |
{ | |
Nome = nome; | |
Matricula = matricula; | |
DataNascimento = dataNascimento; | |
Cpf = cpf; |