Skip to content

Instantly share code, notes, and snippets.

View chrnx-dev's full-sized avatar

Diego Resendez chrnx-dev

View GitHub Profile

Keybase proof

I hereby claim:

  • I am zerooneit on github.
  • I am diegoresendez (https://keybase.io/diegoresendez) on keybase.
  • I have a public key whose fingerprint is 6DC2 D76B 4858 1E5B 9971 C894 C35C 5796 264E FD3E

To claim this, I am signing this object:

export async function createResource(req,res) {
try {
// cuando utilizar await y cuando no ?
/* Siempre que requieras un valor de una funcion async o await y que tu resultado no dependa de esa llamada*/
// processResource puede tomar 2 o 3 minutos por eso creo que no deberia tener await
// para no tener esperando la respuesta del endpoint hasta que termine
/* processResource debes usar await, ya que creo que tu resultado depende de esa funcion, no importa cuanto tome al final si dependes
mostrar el resultado en resourceId, deberias refactorizar processResource de otro modo nodejs y express siempre entregara un undefined*/
@chrnx-dev
chrnx-dev / jwt-strategy.ts
Created March 20, 2019 15:46
Passport JWT Strategy Example
import JWT from '@core/classes/JWT';
import { JWT_AUDIENCE, JWT_HEADER, JWT_ISSUER, JWT_SECRET } from '@core/constants';
import * as mongoose from 'mongoose';
import { ExtractJwt, Strategy } from 'passport-jwt';
export default async function jwt(passport) {
const User = mongoose.model('User');
const options = {
audience: JWT_AUDIENCE,
ignoreExpiration: true,
@chrnx-dev
chrnx-dev / apply.js
Created January 27, 2015 18:45
Make sure to send all to the view without $apply
scope.$on('someEvent', function(e, data){
/**
* Make sure to send information to the view without use $apply
*
**/
scope.$evalAsync(function(){
scope.model = data;
});
}
@chrnx-dev
chrnx-dev / proxy.md
Last active December 28, 2015 22:09
Proxy NodeJS app to Nginx Proxy

###After Install Nginx

After Install Nginx need to configure the files to add proxy to nginx

cd /etc/nginx/sites-available/
vim test

In the file you need to paste the next code.