O syntax parser do javascript adiciona ponto-e-virgulas automaticamente. (ASI: automatic semicolon insertion)
Erros possíveis:
randomNumber(x){
return
{
number : x
$ cd ~/mongo/bin
$ ./mongod --dbpath ~/mongo-data (or w.e path)
or
$ cd ~/mongo/bin && ./mongod --dbpath ~/mongo-data (or w.e path)
or
$ brew services start [email protected]
// começar ficheiro em modo debugging | |
// Entra no modo debugging | |
node inspect file.js~ | |
// mostra nLinhas de codigo em cima em baixo | |
list(nLinhas) | |
// executar linha a linha (n de next) | |
n |
# Iniciar | |
git init | |
# Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'. | |
# "Stage" | |
git add -A | |
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again. | |
git commit -m "First commit" |
namespace Bioliving\Database; | |
// Depois atualizar o composer.json com: | |
"autoload": { | |
"psr-4": { | |
"Bioliving\\": "src/config" | |
} | |
} | |
Ir a Xampp/apache/Conf/Extra | |
Adicionar: | |
<VirtualHost *:80> | |
DocumentRoot "C:/xampp/htdocs\labmm4\Bioliving-API\public" | |
ServerName slimapp | |
</VirtualHost> | |
Feito! |
Debugging: chrome://net-internals/#events | |
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS | |
Access-Control-Allow-Credentials: 'Content-type, Authorization' | |
Access-Control-Allow-Origin: $ORIGIN | |
$ORIGIN = if(inWhitelist(requestOriginHeader) return requestOriginHeader | |
// Se esta na whitelist entao meter esse domain la | |
// Incluir ports no Allow Origin Header!!! |
/* | |
Ficheiro: exported.js | |
*/ | |
export const dataNascimento = '1996-08-15'// Apenas uma variavel/func o que for | |
export function idade(){ | |
return (new Date().getFullYear() - dataNascimento) | |
} | |
// Ou tudo numa linha, estamos a exportar um objecto com todas as propriedades seleccionadas |
/* | |
A promise is created with a resolve and reject function being | |
passed as arguments. Depending on the result, the appropriate function is | |
executed and a possible return value is passed as an argument. | |
*/ | |
let promise = new Promise((resolve,reject)=>{ | |
// then(func) | |
resolve('Ola!') | |