Posts

Showing posts from June, 2017

Docker Dev Environment with Nodemon and Mongo DB

Image
1 Install Docker  Community ediction and Composer https://blog.codeship.com/using-docker-compose-for-nodejs-development/ 2 . Sampe application resides in server folder which have the package.json file ensure package.json  has script.  "start": "nodemon -L index.js" ensure nodemon.json exhist 3. touch Dockerfile. FROM node:8.1.0-alpine RUN mkdir /server RUN npm install nodemon -g ADD ./server /server WORKDIR /server RUN npm install #ADD server/nodemon.json /server/nodemon.json EXPOSE 3000 CMD npm start 5. docker-compose build 6.touch docker-compose.yml version: '2' services:   web:     build: .     volumes:     - "./server:/server"     ports:       - "3000:3000"     links:       - mongo   mongo:     image: mongo:3.4.4     container_name: mongo     ports:       - "27017:27017" 7.docker-co...

Firebase Promises

Image
 Firebase Nodejs requests are Asyncronus .Which means, in the follwing code block I need to check order users exhist before set user. But the user order insert fucntion written second will fire before validation finished .Developer need to careful on this when firebase adopted.     for(var user in users) {                                              f irebase.database().ref("users"); users.once("value", function(snapshot) {                                      var temp= snapshot.exists();                                                             if (temp) {             ...

Firebase REST API auth - access token

I have to use Firebase Database and server a REST API .I need to allow the REST API call only for authenticated users from the same freebase. According to Documentation on REST API Save data > Auth Section I able to successfully access the Database using database secret . https://firebase.google.com/docs/database/rest/save-data But I could not successfully retrieve the data using access token of authenticated user . https://<<removed-my-project-id>>.firebaseio.com/users.json?access_token=ya29.GlxuBLxJ6R2uNYJ7SXnMhe7Inqw94ShGeZ7MTBmyxYUI2cLDCXJcPAfbo1_uKLjUhfPX3uQw_ElBjIVwu73caeKJfBAh87GGRWZx2JiSwuIZybAmtVXyFyqaeYbAJQ Reffering confusing document again I pass the URL as fallows using the idtoken.(currentUser.getIdToken taken from cleint side) https:// <<my-project-id>> .firebaseio.com/users.json?auth=eyJhbGciOiJSUzI1NiIsImtpZCI6IjBkNWNlYjA1ODA2ODk3OTM3ZTAxNGFjMDNkYWZkODQyMzM4ZjBlNmQifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vZmV0Y2htZS1...

Custom Email template for Laravel Password Reset

Image
Today I got new task with laravel , since I  have forget passwrod reset scenario. It works but not using the UIs of our theme.Scpecailly mail. However reset pasword section of the follwing helps me . http://miftyisbored.com/a-complete-laravel-5-3-tutorial-for-user-authentication-with-activation-email/ Mailtrap will help you. php artisan vendor:publish --tag=laravel-notifications     // email template php artisan make:notification ResetPassword.          .//edit temaplte parameters chage user class to call notification   public function sendPasswordResetNotification($token)     {         $this->notify(new ResetPassword($token));     } change ResetPassword in notification folder  eg : namespace App\Notifications; use Illuminate\Notifications\Notification; use Illuminate\Notifications\Messages\MailMessage; class PasswordResetNotification ...

Laravel Session Time Out - Trying to get property of non-object Error

Image
I have faced the follwing  error in laravel in user logged pages . Laravel Session Time Out  - Trying to get property of non-object Error The reason for error is session time out of the logged user but it not properly handled in the views . In larvel if the logged in user from auth , can be logged out using same auth middleware. Route::post('controllerName','folderName\fileName@fnNmae')- >middleware('auth'); https://stackoverflow.com/questions/34443632/make-session-expiration-redirect-back-to-login