theory Flashcards

1
Q

responsibilities of backend programmers could easily involve

A

writing APIs,
writing code to interact with a database,
creating modules or libraries,
working on business data and architecture

Coordinate and communicate with frontend developers to transfer data efficiently to the client side of the application.

Collaborate with quality assurance engineers to optimize the server-side processes and pass some security checks.

Optimize the application when the number of requests or users scales as well.

Analyze the requirements of the project and create a simple structure to handle bugs and errors.

Propose efficient solutions for cloud hosting but also build CI/CD pipelines.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is an API?

A

It consists mainly of two components:

The technical specification, which describes the data exchange options between the parties, with the specification made in the form of a request for data delivery protocols and data processing.

The software interface (the programming code), which is written to the specification that represents it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Web APIs are relatively common and there are different specifications and protocols.

A

Remote Procedure Call (RPC)
Simple Object Access Protocol (SOAP)
REST/RESTful

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The REST architecture uses the original specifications of the HTTP protocol

A

Rule 1: The URL is a resource identifier

Rule 2: HTTP verbs are identifiers of operations

Rule 3: HTTP responses are representations of resources

Rule 4: Links are relations between resources

Rule 5: A parameter is an authentication token

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

HTTP Requests

A

https://www.educative.io/courses/full-stack-django-and-react/what-is-an-api#Understanding-REST-APIs

https://miro.medium.com/v2/resize:fit:960/1*iDq9WkZDedlMW_1bCtZo_w.png

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why use Django?

A

It provides code and tools for common operations such as database manipulation, HTML templates, URL routing, session management, and security.

Django allows developers to build all kinds of web applications (social networks, news sites, and wikis) with all the necessary basics

Django provides protection against common attacks—cross-site scripting, SQL injection, and much more.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Django REST Framework (DRF)

A

It’s the most mature, testable, well-documented, and easily extendable framework, which will help create powerful RESTful APIs when coupled with Django.

The combination of Django and the DRF is used by large companies such as Instagram, Mozilla, and even Pinterest.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Setting Up the Work Environment

A

https://www.educative.io/courses/full-stack-django-and-react/setting-up-the-work-environment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Migrations are

A

just a way to propagate changes made to the model in the database schema.

When we write our own models, we’ll also be creating migrations files and migrating them.

No need to write SQL commands here—we’ll just write code in Python that will be directly translated into SQL. The command python manage.py migrate will then apply these changes to the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Django has object-relational mapping (ORM) that

A

automatically handles the interaction with the database for us.

When we create a model in our Django application, the framework will automatically create a suitable table in the database that will save the data relating to the model.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Project components

A

settings.py: This contains all the configurations for your Django projects. You can find SECRET_KEY, the INSTALLED_APPS list, ALLOWED_HOST, and so on.

manage.py: It’ll help us create projects and applications, run migrations, start a server, and so on.

urls.py: This contains all the URLs that will be used to access resources in the project:

???

wsgi.py: This file is basically used for deployment but also as the default development environment in Django.

asgi.py: Django also supports running asynchronous codes as an ASGI application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

sqlite3 as a database,

A

which is an in-process library that implements a
fast
self-contained,
zero-configuration,
serverless,
transactional
SQL database engine.
It’s very compact and
easy to use and set up.
It’s ideal for testing or if we’re looking to save data quickly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

some sqlite3 disadvantages.

A

no multi-user capabilities
reads and writes directly to an ordinary disk file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

PostgreSQL

A

User-defined types

Table inheritance

Asynchronous replication

Multi-user capabilities

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Installing an HTTP request client

A

API clients are packages or libraries that send HTTP requests to an API. The majority supports features such as SSL checking, authentication, and header modification.

we’ll be working with Insomnia. It’s lightweight and simple to use and customize.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

JSON Web Token (JWT) is

A

a data structure used for exchanging information securely between parties in web development and is typically used for authentication and authorization purposes.

17
Q

creating a table in SQL will require writing a long SQL query. Doing this in Python will just require

A

writing a class inheriting from the django.db package and add instructions for every field contained

18
Q

Writing models with Django comes with several advantages:

A

Simplicity
Consistency
Tracking

19
Q

Django Manager is a class that

A

comes with the necessary methods to make Create, Read, Update and Delete (CRUD) operations on the table in the database.

Every Django model, by default, inherits the models.Manager

20
Q

Django comes with a built-in User model class that we can use for

A

basic authentication or a session.

It actually provides an authentication feature we can use to quickly add authentication and authorization to our projects.

21
Q

A Django application is

A

a submodule of a Django project.

It’s a Python package structured to work in a Django project and share Django conventions such as containing files or submodules such as models, tests, urls, and views.

22
Q

What is JWT?

A

JWT stands for JSON Web Token.

According to RFC 7519, a JWT is a JSON object defined as a safe way of transmitting information between two parties. Information transmitted by JWT is digitally signed so it can be verified and trusted.

23
Q

When you run python manage.py shell

A

you run a python (or IPython) interpreter but inside it load all your Django project configurations so you can execute commands against the database or any other resources that are available in your Django project.

24
Q

serialization vs deserialization

A

https://velog.velcdn.com/images/bruce1115/post/8b751489-e8a5-4b81-a13e-9b346beecd74/image.png

25
Q

a viewset is simply a

A

class-based view that can handle all the basic HTTP requests — GET, POST, PUT, DELETE, and PATCH—without hardcoding any CRUD logic here.

with DjangoRestFramework, the model can be directly connected to the view. However, it’s good practice to use a serializer between a model and a viewset.

26
Q

To register a route for a viewset, the register() method

A

The prefix: Essentially represents the name of the endpoint.

The viewset: Represents a valid viewset class.

The basename: is optional; it helps with readability and also helps Django for URL registry purposes

27
Q

Insomnia is a

A

REST client tool used to make requests to RESTful API

It offers support for:
- cookie management,
- environment variables,
- code generation,
- authentication.

28
Q

adding the login endpoint following the same process:

A

writing the serializer
writing the viewset,
registering the route.