Skip to content

Instantly share code, notes, and snippets.

View agustinlopez23's full-sized avatar
🏠
Working from home

Agustin Lopez agustinlopez23

🏠
Working from home
View GitHub Profile
@agustinlopez23
agustinlopez23 / Net Core Terminal code.txt
Last active August 11, 2024 02:47
.Net Core Terminal code
Instalaciones
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet tool install --global dotnet-ef
------------------------------------------------------------------------------------------------------------------------
Scaffold EF
Power Shell
dotnet ef dbcontext scaffold "Server=.\SQLEXPRESS;Database=AdventureWorks2022;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer --context-dir .\Data --output-dir .\Data\Models --namespace Your.Custom.Namespace --project path\to\your\project.csproj
Una de las dificultades que encuentran aquellos que se adentran al mundo del NoSQL es al tratar de transformar su esquema de base de datos relacional para que funcione de la mejor manera segun el enfoque NoSQL orientado a documentos, como lo es MongoDB. Aquí aprenderemos sobre como realizar correctamente el modelado de datos para que puedas comenzar a pensar en migrar tus proyectos a este tipo de base de datos con la menor dificultad posible.
* * *
## Tipos de Datos
Al comienzo de la serie explicamos que los documentos de MongoDB son como objetos JSON, para ser especificos son de tipo BSON (JSON Binario), esta estrategia permite la serialización de documentos tipo JSON codificados binariamente. Veamos algunos de los tipos de datos que soporta:
* `String` - Cadenas de caracteres.
* `Integer` - Números enteros.

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? ☆☆

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com

@agustinlopez23
agustinlopez23 / index.js
Created June 15, 2024 05:51
Dynamic Route Reading With NodeJS
import { Router } from 'express'
import { readdirSync } from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const __filename = fileURLToPath(import.meta.url)
const PATHNAME = path.dirname(__filename)
const router = Router()
const cleanFileName = (filename) => {
@agustinlopez23
agustinlopez23 / errorHandler.js
Created December 8, 2023 21:38
error handler NODEJS template
const badRequestError = (msg, code = 'BAD_REQUEST_ERROR') => {
let err = new Error()
err.code = code
err.httpStatus = 400
err.message = msg
throw err
}
@agustinlopez23
agustinlopez23 / delete.js
Created January 15, 2023 22:46
Form for delete for an array with a condicional
const deleteElementOfArray= (array, id) => {
const foundElement = array.find((el) => el.id === id);
if (foundElement) {
return array.splice(array.indexOf(foundElement), 1);
} else {console.log("The element was not founded in:",array }
},
@agustinlopez23
agustinlopez23 / database.rules.json
Last active January 15, 2023 05:37 — forked from codediodeio/database.rules.json
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}