Posts

Showing posts from January, 2022

ANGULAR

 * NPM stand for node package manager * npm install -g @angular/cli    is used to install angular cli in  your computer sytem * ng new my-app   - to create new project name my-app * CORS , We need to configure the cors because django drf run on different port and angular run on different port , so to tell django ist's ok that they both run on different port we need to configure the CORS * angular use httpClient to make a HTTP call to send request to the backedn * Service is used for API call in angular and component is useful for UI * ng g c components/passengerDetails   -------> This is used for creating the component * ng g s services/login -  for creating the service * 

DJANGO 2022

 * to use django drf  first step is in setttins.py - installed app- rest_framework * request is responsible for getting data and response is responsible for sending data * We will use status code , if our request get ok or not  like status .https_201_created for ok and  status.https_404_bad_request if not ok, from rest_framework import status * @api_view is a decorator and used in function based view where as ApiView is used in class based views * we can say that the above line are marker ki ye function API ko handle krta hai, ye class API ko handle krti hai, and we can also set there ki ye sir DELETE request leta hai, ye function sirf POST request leta hai. * Instead of using API view if we use mixin, then our number of lines of code will reduced * First we have to configure paginations in settings.py file  * this inbuilt pagination work for generic and view sets * We can do pagination at settings.py level - isse bhi kaam ho jata hai as well as we can do pagina...