Kayıtlar

Deploy and config NGINX on Angular 7 + Nginx Docker

Create and run docker image docker run --name app-nginx -p 9595:80 -v /media/storage/angular7nginx-app/:/usr/share/nginx/html:ro -d nginx Go to docker image docker exec -ti app-nginx /bin/bash vim /etc/nginx/nginx.conf Add these line of code inside the http Restart docker container Check docker logs docker logs app-nginx app-nginx is application name server {     listen 80;     listen [::]:80;     server_name http://ip;     root /usr/share/nginx/html;     index index.html index.htm;     location / {         try_files $uri $uri/ /index.html; # This will allow you to refresh page in your angular app. Which will not give error 404.     } } usefull commands on docker: docker commit app-nginx nginx:latest  --> create a new docker with latest tag docker logs app-nginx -f                       ...

Data Structure in JavaScript

At a high level, there are basically three types of data structures.  Stacks  and  Queues  are  array-like  structures that differ only in how items are inserted and removed.  Linked Lists ,  Trees ,   and  Graphs  are structures with  nodes  that keep  references  to other nodes.  Hash Tables  depend on  hash functions  to save and locate data. In terms of complexity , Stacks  and  Queues  are the simplest and can be constructed from  Linked Lists .  Trees  and  Graphs  are the most complex because they extend the concept of a linked list.  Hash Tables  need to utilize these data structures to perform reliably.  In terms of efficiency ,  Linked Lists  are most optimal for  recording  and  storing  of data,  while  Hash Tables  are most performant for  searching ...

OOP in JavaScript

Let's start by looking at how you could define a person with a normal function. Add this function within the  script  element: function createNewPerson ( name ) { var obj = { } ; obj . name = name ; obj . greeting = function ( ) { alert ( 'Hi! I\'m ' + obj . name + '.' ) ; } ; return obj ; } You can now create a new person by calling this function — try the following lines in your browser's JavaScript console: var salva = createNewPerson ( 'Salva' ) ; salva . name ; salva . greeting ( ) ; This works well enough, but it is a bit long-winded; if we know we want to create an object, why do we need to explicitly create a new empty object and return it? Fortunately, JavaScript provides us with a handy shortcut, in the form of constructor functions — let's make one now! Replace your previous function with the following: function Person ( name ) { this . name = name ; this . greeting = function ( ) { ...