MCPcopy Create free account

hub / github.com/DsThakurRawat/Backend-from-first-Principle / functions

Functions414 in github.com/DsThakurRawat/Backend-from-first-Principle

↓ 1 callersFunctionrun_client
()
24.Web-Sockets-And-Real-time-Communication-with-WebSockets/code/python/a_websocket_client_2.py:4
↓ 1 callersFunctionsearchHandler
(pool *pgxpool.Pool)
11.Full text search using Elasticsearch for blazingly fast search/code/go/go_full_text_search_handler_1.go:19
↓ 1 callersFunctionsearch_reviews
(query: str, sentiment_filter: str = None)
11.Full text search using Elasticsearch for blazingly fast search/code/python/streaming_results_from_two_sources_nodej_2.py:1
↓ 1 callersMethodserialize
(self, obj)
3.Serialization-and-Deserialization-or-backend-engineers/code/python/serialization_in_python_1.py:10
↓ 1 callersFunctionsetup_tracing
(app)
15.Logging, Monitoring and Observability/tracing.py:9
↓ 1 callersMethodstartup
(self)
16.Graceful Shutdown/code/python/72_graceful_shutdown_in_python_1.py:15
↓ 1 callersFunctionstep
()
20.Concurrency & Parallelism: IO Bound vs CPU Bound/code/python/two_things_this_explains_4.py:7
↓ 1 callersMethodto_dict
(self)
3.Serialization-and-Deserialization-or-backend-engineers/code/python/serialization_in_python_1.py:43
↓ 1 callersMethodtrim
(cls, v: str)
5. Validations and transformations for backend engineers/code/python/example_8.py:13
↓ 1 callersMethodunregister
(self, ws: WebSocket)
24.Web-Sockets-And-Real-time-Communication-with-WebSockets/code/python/connection_management_3.py:11
↓ 1 callersFunctionverify
(token: str)
4.Authentication and authorization for backend engineers/code/python/05_json_web_tokens_jwt_3.py:18
↓ 1 callersFunctionwithEmail
(e string)
22.Automated-Testing-Unit-Integration-and-E2E/code/go/fixtures_factories_8.go:9
↓ 1 callersFunctionwriteError
(w http.ResponseWriter, status int, code, msg string, details ...FieldError)
7.API-DESIGN-RestAPI/code/go/a_consistent_error_envelope_5.go:6
FunctionApprovePaymentHandler
To send approval signal from your API handler:
10.Task queues and background job/workflows/payment_approval.go:30
FunctionArchiveOrganization
(w http.ResponseWriter, r *http.Request)
7.API-DESIGN-RestAPI/code/go/worked_example_a_pm_platform_4.go:35
FunctionAuthMiddleware
(next http.Handler)
6.controllers-services-repositories-middlewares-and-request-context/code/go/12common_middlewares_6.go:13
FunctionAuthenticate
(w http.ResponseWriter, email, pw string)
4.Authentication and authorization for backend engineers/code/go/17_error_messages_timing_attacks_12.go:4
FunctionBadRequest
(msg string, details any)
12. Error Handling and Building Fault Tolerant Systems/errors/types.go:22
FunctionBenchmarkParseEvent
Benchmarks live beside tests; the tool tunes b.N until timing is stable.
22.Automated-Testing-Unit-Integration-and-E2E/code/go/performance_load_testing_10.go:2
FunctionCORSMiddleware
(next http.Handler)
6.controllers-services-repositories-middlewares-and-request-context/code/go/12common_middlewares_6.go:3
FunctionCanEdit
Policy: can `s` perform `action` on `r`, given the environment?
4.Authentication and authorization for backend engineers/code/go/16_authorization_rbac_11.go:5
FunctionCheckCSRF
Double-submit: compare the CSRF cookie against the header.
4.Authentication and authorization for backend engineers/code/go/06_cookies_5.go:2
FunctionCheckPassword
bcrypt.CompareHashAndPassword is constant-time internally
4.Authentication and authorization for backend engineers/code/go/04_sessions_1.go:30
FunctionConflict
(msg string)
12. Error Handling and Building Fault Tolerant Systems/errors/types.go:19
FunctionCreateBookHandler
(w http.ResponseWriter, r *http.Request)
6.controllers-services-repositories-middlewares-and-request-context/code/go/14use_case_passing_authentication_data_7.go:1
FunctionCreateBookHandler
(w http.ResponseWriter, r *http.Request)
6.controllers-services-repositories-middlewares-and-request-context/code/go/a_note_on_nodejs_vs_go_python_1.go:7
FunctionCreateOrganization
(w http.ResponseWriter, r *http.Request)
7.API-DESIGN-RestAPI/code/go/worked_example_a_pm_platform_4.go:15
FunctionCreatePayment
(w http.ResponseWriter, r *http.Request)
7.API-DESIGN-RestAPI/code/go/post_the_only_non_idempotent_one_2.go:1
FunctionCreateTodo
(ctx context.Context, req models.CreateTodoRequest, userID string)
15.Logging, Monitoring and Observability/services/todo_service.go:17
MethodDatabaseURL
DatabaseURL constructs the connection URL from the parts.
14.Production-grade Configuration Management/code/go/93_example_yaml_config_file_1.go:38
FunctionDeleteOrganization
(w http.ResponseWriter, r *http.Request)
7.API-DESIGN-RestAPI/code/go/worked_example_a_pm_platform_4.go:30
MethodDeserialize
(data []byte, v any)
3.Serialization-and-Deserialization-or-backend-engineers/code/go/serialization_in_go_1.go:22
FunctionEmailWorker
Consumer: runs as a separate process (or goroutine)
19.Backend Scaling and Performance Engineering: Part-2/code/go/example_3.go:20
FunctionEnhancedTracing
()
15.Logging, Monitoring and Observability/middleware/tracing.go:13
FunctionEnqueueEmail
Producer: push job to queue (called from your API handler)
19.Backend Scaling and Performance Engineering: Part-2/code/go/example_3.go:14
FunctionEnqueueEmailTask
── PRODUCER ──────────────────────────────────────────
10.Task queues and background job/code/go/how_sqs_visibility_timeout_works_aws_spe_1.go:12
MethodFindBookByID
A SEPARATE method for the single-book case. No optional toggles.
6.controllers-services-repositories-middlewares-and-request-context/code/go/07the_repository_layer_4.go:19
MethodFindByID
(string)
22.Automated-Testing-Unit-Integration-and-E2E/code/go/test_doubles_3.go:14
FunctionGET
(req)
11.Full text search using Elasticsearch for blazingly fast search/code/javascript/streaming_results_from_two_sources_nodej_1.js:4
FunctionGetPostsWithAuthors
(ctx context.Context, db *sql.DB)
18. Backend Scaling and Performance Engineering-part-1/code/go/example_4.go:1
FunctionGetProduct
GetProduct implements Cache-Aside (Lazy) caching. 1. Check Redis first 2. On miss, fetch from DB, store in cache, return
9.Caching, the secret behind it all/code/go/104_session_management_with_redis_python_1.go:25
FunctionGetProduct
(ctx context.Context, id string)
18. Backend Scaling and Performance Engineering-part-1/code/go/example_6.go:10
MethodGetRequestMetadata
(ctx context.Context, _ ...string)
13.gRPC-and-Inter-Service-Communication-for-Microservices/code/go/authentication_security_9.go:14
FunctionGetSession
GetSession retrieves session data — works regardless of which server the request lands on, because Redis is shared across all instances.
19.Backend Scaling and Performance Engineering: Part-2/code/go/example_1.go:16
FunctionGlobalErrorHandler
GlobalErrorHandler wraps a handler that returns an error.
12. Error Handling and Building Fault Tolerant Systems/middleware/error_handler.go:20
MethodHandle
(req Request)
2.Routing-in-backend/Router.go:18
MethodHandle
Handle is the method that satisfies the Handler INTERFACE Because GetUser has Handle(req Request) Response, Go says "GetUser IS-A Handler" — it can be
2.Routing-in-backend/Router.go:207
MethodHandle
(req Request)
2.Routing-in-backend/Router.go:222
MethodHandle
(req Request)
2.Routing-in-backend/code/go/a_router_in_go_1.go:73
MethodHandle
(req Request)
2.Routing-in-backend/code/go/a_router_in_go_1.go:79
MethodHandleDeleteAccount
Go — Idempotent multi-step task with full transaction rollback
10.Task queues and background job/code/go/pattern_4_exactly_once_via_sqs_fifo_dedu_2.go:2
MethodHandleSendEmail
Usage in Asynq handler
10.Task queues and background job/rate/sliding_window.go:38
MethodHandleSendVerificationEmail
HandleSendVerificationEmail — registered with the Asynq server
10.Task queues and background job/handlers/email_handler.go:18
FunctionHashArgon
returns an encoded string: salt + params + hash
4.Authentication and authorization for backend engineers/code/go/04_sessions_2.go:28
FunctionHashPassword
(password string)
17.Backend Security: Everything You Need to Know/code/go/slow_hashing_defeating_brute_force_3.go:7
FunctionHashPassword
hash once at signup; store hash, never the password
4.Authentication and authorization for backend engineers/code/go/04_sessions_1.go:24
FunctionInit
()
15.Logging, Monitoring and Observability/logger/logger_1.go:12
FunctionInternal
(err error)
12. Error Handling and Building Fault Tolerant Systems/errors/types.go:25
FunctionListBooksHandler
(w http.ResponseWriter, r *http.Request)
6.controllers-services-repositories-middlewares-and-request-context/code/go/a_note_on_nodejs_vs_go_python_2.go:1
FunctionListOrganizations
GET /v1/organizations?status=active&sortBy=name&sortOrder=ascending&page=1&limit=10
7.API-DESIGN-RestAPI/code/go/filtering_3.go:2
FunctionLoad
Load reads env vars, applies defaults, then VALIDATES before returning. Called once at startup — fail loudly here, never silently in production.
14.Production-grade Configuration Management/code/go/93_example_yaml_config_file_1.go:47
FunctionLoggingMiddleware
In Go, middleware wraps the "next" handler. Calling next.ServeHTTP is the equivalent of next(): pass execution along the chain.
6.controllers-services-repositories-middlewares-and-request-context/code/go/10the_next_function_5.go:3
FunctionLogin
(w http.ResponseWriter, u User)
4.Authentication and authorization for backend engineers/code/go/04_sessions_1.go:40
FunctionMustLoad
MustLoad panics if any required variable is missing. Call this once in main() before http.ListenAndServe.
12. Error Handling and Building Fault Tolerant Systems/code/go/go_config_validation_at_boot_1.go:18
FunctionNew
()
15.Logging, Monitoring and Observability/logger/logger.go:22
FunctionNewSendVerificationEmailTask
NewSendVerificationEmailTask creates the Asynq task
10.Task queues and background job/tasks/email.go:21
FunctionNotFound
Constructors
12. Error Handling and Building Fault Tolerant Systems/errors/types.go:16
MethodNotifyOwner
A service that needs no database at all is perfectly valid:
6.controllers-services-repositories-middlewares-and-request-context/code/go/06the_service_layer_3.go:14
FunctionPaymentApprovalWorkflow
workflows/payment_approval.go — Wait for human signal
10.Task queues and background job/workflows/payment_approval.go:2
FunctionPollQueue
── CONSUMER ──────────────────────────────────────────
10.Task queues and background job/code/go/how_sqs_visibility_timeout_works_aws_spe_1.go:25
FunctionPrometheusMetrics
()
15.Logging, Monitoring and Observability/middleware/metrics.go:25
FunctionRateLimitMiddleware
(rdb *redis.Client)
9.Caching, the secret behind it all/code/go/104_session_management_with_redis_python_2.go:17
FunctionRateLimitMiddleware
(next http.Handler)
17.Backend Security: Everything You Need to Know/code/go/three_layers_of_rate_limiting_5.go:24
FunctionRefresh
Rotate a refresh token; detect reuse of an already-spent one.
4.Authentication and authorization for backend engineers/code/go/05_json_web_tokens_jwt_4.go:16
FunctionRegenerateSession
Regenerate the session ID right after a successful login.
4.Authentication and authorization for backend engineers/code/go/06_cookies_5.go:19
FunctionRegisterOrgRoutes
(mux *http.ServeMux)
7.API-DESIGN-RestAPI/code/go/worked_example_a_pm_platform_4.go:1
FunctionRequestIDMiddleware
(next http.Handler)
6.controllers-services-repositories-middlewares-and-request-context/code/go/cancellation_abort_signals_deadlines_8.go:1
FunctionRequireAPIKey
(lookup func(hash string) (*Client, bool))
4.Authentication and authorization for backend engineers/code/go/10_api_key_authentication_8.go:14
FunctionRequireJWT
(next http.HandlerFunc)
4.Authentication and authorization for backend engineers/code/go/08_stateless_authentication_7.go:3
FunctionRequireRole
RequireRole runs AFTER an auth middleware that set "user".
4.Authentication and authorization for backend engineers/code/go/16_authorization_rbac_10.go:2
FunctionRequireSession
RequireSession reads the sid cookie and looks it up in Redis.
4.Authentication and authorization for backend engineers/code/go/07_stateful_authentication_6.go:2
MethodRequireTransportSecurity
()
13.gRPC-and-Inter-Service-Communication-for-Microservices/code/go/authentication_security_9.go:17
MethodSave
(o Order)
22.Automated-Testing-Unit-Integration-and-E2E/code/go/dependency_injection_for_testability_4.go:15
MethodSend
(to, msg string)
22.Automated-Testing-Unit-Integration-and-E2E/code/go/test_doubles_3.go:17
MethodSerialize
(v any)
3.Serialization-and-Deserialization-or-backend-engineers/code/go/serialization_in_go_1.go:19
FunctionSign
mint a self-contained token carrying the claims
4.Authentication and authorization for backend engineers/code/go/05_json_web_tokens_jwt_3.go:11
FunctionStoreSession
StoreSession saves session data in Redis so ANY server can read it.
19.Backend Scaling and Performance Engineering: Part-2/code/go/example_1.go:10
FunctionTestApplyDiscount
(t *testing.T)
22.Automated-Testing-Unit-Integration-and-E2E/code/go/table_driven_parametrized_tests_5.go:1
FunctionTestCreateUser_Returns201
(t *testing.T)
22.Automated-Testing-Unit-Integration-and-E2E/code/go/testing_http_handlers_apis_7.go:8
FunctionTestDiscount_AppliesPercentage
File naming convention: foo.go is tested by foo_test.go in the same package. Test functions are func TestXxx(t *testing.T) — the `go test` tool finds
22.Automated-Testing-Unit-Integration-and-E2E/code/go/anatomy_of_a_test_1.go:3
FunctionTestFetchRate
2) Stub an external HTTP API with httptest.Server — no real network.
22.Automated-Testing-Unit-Integration-and-E2E/code/go/mocking_time_randomness_external_apis_9.go:15
FunctionTestGreet_SendsEmail
(t *testing.T)
22.Automated-Testing-Unit-Integration-and-E2E/code/go/test_doubles_3.go:19
FunctionTestIsStrongPassword
(t *testing.T)
22.Automated-Testing-Unit-Integration-and-E2E/code/go/unit_tests_2.go:12
FunctionTestPlace_RejectsInvalidTotal
(t *testing.T)
22.Automated-Testing-Unit-Integration-and-E2E/code/go/dependency_injection_for_testability_4.go:17
FunctionTestSignup
(t *testing.T)
22.Automated-Testing-Unit-Integration-and-E2E/code/go/fixtures_factories_8.go:20
FunctionTestTokenExpiry
(t *testing.T)
22.Automated-Testing-Unit-Integration-and-E2E/code/go/mocking_time_randomness_external_apis_9.go:6
FunctionTestUserRepo_SaveAndFind
Build tag keeps slow integration tests out of the fast unit run: go:build integration → run with: go test -tags=integration ./...
22.Automated-Testing-Unit-Integration-and-E2E/code/go/testing_with_a_real_database_6.go:3
FunctionTimingMiddleware
TimingMiddleware logs the duration of every HTTP request.
18. Backend Scaling and Performance Engineering-part-1/code/go/example_2.go:10
FunctionUpdateOrganization
(w http.ResponseWriter, r *http.Request)
7.API-DESIGN-RestAPI/code/go/post_the_only_non_idempotent_one_1.go:1
FunctionUpdateProduct
Write-Through: update DB and cache simultaneously
9.Caching, the secret behind it all/code/go/104_session_management_with_redis_python_1.go:52
← previousnext →101–200 of 414, ranked by callers