teleren/devto huggingface dataset:
API Gateway: the ultimate middleman for all your proxying needs
Tags: api, awsapigateway, aws, backend
Published: 2023-01-07 09:24:48

---
title: API Gateway: the ultimate middleman for all your proxying needs
published: true
date: 2023-01-06 22:25:11 UTC
tags: API,AWSAPIGateway,AWS,Backend
canonical_url: https://techdevblog.io/api-gateway-the-ultimate-middleman-for-all-your-proxying-needs/
---

 ![API Gateway: the ultimate middleman for all your proxying needs](https://techdevblog.io/content/images/2023/01/image_0-9.png)

[AWS API Gateway](https://aws.amazon.com/api-gateway/) is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. One way you can use [API Gateway](https://aws.amazon.com/api-gateway/) is as a proxy, by using the HTTP integration type.

But why would you want to use [API Gateway](https://aws.amazon.com/api-gateway/) as a proxy? Here are a few reasons:

- You want to expose an existing HTTP/HTTPS service without having to worry about the underlying infrastructure.
- You want to add [API Gateway](https://aws.amazon.com/api-gateway/)-specific functionality, such as API keys, rate limiting, and caching, to an existing service.
- You want to perform tasks such as header mapping, query string manipulation, and body mapping between the client and the backend service.

When should you use [API Gateway](https://aws.amazon.com/api-gateway/) as a proxy? Some use cases include:

- Exposing an on-premises service to the internet.
- Exposing a service hosted in another VPC.
- Exposing a service hosted on EC2 or on-premises.

Now, let's talk about how to use [API Gateway](https://aws.amazon.com/api-gateway/) as a proxy with HTTP integration using the [AWS console](https://console.aws.amazon.com). Here are the steps:

1. Navigate to the API Gateway console and create a new API.
2. Create a new resource and method for the API. For the method, choose `ANY` as the HTTP method and select `HTTP` as the integration type.
3. In the `HTTP Integration` section, enter the URL of the backend service in the `Endpoint URL` field.
4. If the backend service requires any specific headers or query strings, you can specify them in the `HTTP Headers` and `Query String Parameters` fields.
5. In the `Body Mapping Templates` section, you can specify how the request and response bodies should be transformed between the client and the backend service. This is optional, but can be useful for tasks such as converting between different data formats (e.g., JSON to XML).
6. Save and deploy your API.

That's it! You can now send requests to your [API Gateway](https://aws.amazon.com/api-gateway/) endpoint and they will be proxied to the backend service.

I hope this short introductory tutorial was helpful and gave you a better understanding of when and how to use [AWS API Gateway](https://aws.amazon.com/api-gateway/) as a proxy with HTTP integration. Happy proxying!

<!--kg-card-end: markdown-->
Refactoring Routes
Published: 2023-01-06 22:11:02

Key learning:

Routes can be refactored quite simply! for example, the route

`get ("/", ({ :controller => "controller_name", :action => "action_name"})`

can be simplified to

`root "controller_name#action_name"`

Fundamentally, this works because the entire argument is just the method being applied to the hash relationship between the controller and the action.

Root is a specific method that works for the index file.
What is the purpose of Node.js and why is it so useful?
Tags: node, javascript, programming, backend
Published: 2023-01-06 22:05:50

Node.js is a runtime environment that executes JavaScript code outside a web browser. It is designed to build scalable network applications and is particularly useful for server-side applications.

Node.js is built on top of the V8 JavaScript engine, the same JavaScript engine that powers the Google Chrome web browser. This makes it a very fast and efficient platform for executing JavaScript code.

One of the main advantages of Node.js is its ability to handle a large number of simultaneous connections with high throughput. This makes it well-suited for real-time applications such as chat, stock tickers, and online games.

Node.js also has a large and active developer community, which has contributed a large number of packages (libraries of code that can be used to build applications) to the npm (Node Package Manager) repository. This makes it easy to find and use packages to build applications, and also makes it easy to share your own packages with the community.

Overall, Node.js is a powerful and useful platform for building network applications and is used by many companies and organizations around the world.
A deep dive into a Bootstrap 5 from a beginner POV
Tags: bootstrap, webdev, css, programming
Published: 2023-01-06 22:03:27

Bootstrap is a popular HTML, CSS, and JavaScript framework for building responsive, mobile-first websites and applications. It provides a set of pre-designed components, layouts, and utility classes that make it easy to create professional-looking, consistent user interfaces.

One of the key features of Bootstrap is its responsive grid system, which allows you to create layouts that automatically adjust to the size and orientation of the device they are being displayed on. This is achieved using a combination of flexible grid layouts, media queries, and responsive utility classes.

Bootstrap also provides a wide range of pre-designed components, such as navbars, buttons, forms, tables, and alerts, that you can use to quickly build common user interface elements. These components can be customized using a combination of HTML, CSS, and JavaScript.

In addition to its core CSS and JavaScript files, Bootstrap also includes a number of optional plugins that provide additional functionality, such as modals, carousels, and popovers. These plugins can be easily included in your project by including the necessary JavaScript and CSS files.

To get started with Bootstrap, you will need to include the Bootstrap CSS and JavaScript files in your project, either by downloading them and linking to them locally, or by including them from a CDN. You can then begin using Bootstrap's pre-designed components and layouts in your HTML, or customize them using your own CSS and JavaScript.

Overall, Bootstrap is a powerful and easy-to-use tool for building professional-looking websites and applications. It is a great choice for beginners, as it provides a wide range of pre-designed components and layouts that can be easily customized to fit your needs.
What are Binary Trees and how do we use them?
Tags: binarytrees, developer, info, learn
Published: 2023-01-06 21:50:57

A binary tree is a data structure that consists of nodes arranged in a tree-like structure. Each node has at most two children, which are referred to as the left child and the right child. The topmost node in the tree is called the root.

Binary trees are often used for searching and sorting data, as they provide a way to organize data in a hierarchical structure and allow for efficient insertion, deletion, and search operations.

There are several common ways to traverse a binary tree, including in-order, pre-order, and post-order traversal. In-order traversal involves visiting the left child, then the current node, and finally the right child. Pre-order traversal involves visiting the current node, then the left child, and finally the right child. Post-order traversal involves visiting the left child, the right child, and then the current node.

There are also various operations that can be performed on binary trees, such as insertion, deletion, and search. Binary search trees are a specific type of binary tree that are used to efficiently search for values in a sorted data set.

Binary trees have many applications, including in computer science, data analysis, and artificial intelligence. They are an important data structure to understand and can be a powerful tool in a developer's toolkit.
Best Practices when working with Android Studio
Tags: android, androidstudio, beginners
Published: 2023-01-06 21:49:20

1. Use the built-in version control integration to manage your code changes and collaborate with other developers.

2. Use the Android Emulator or a physical device to test your app during development, rather than relying on manual testing.

3. Use the Android Lint tool to check your code for potential performance, usability, and security issues.

4. Take advantage of Android Studio's live layout and design previews to quickly see how your app will look on different devices and configurations.

5. Use the Android Profiler to diagnose performance issues and memory leaks in your app.

6. Use product flavors to easily create and maintain different versions of your app, such as a free version with ads and a paid version without ads.

7. Take advantage of Android Studio's built-in support for unit testing to ensure that your code is reliable and maintainable.

8. Use the Gradle build system to automate tasks such as building, testing, and deploying your app.

9. Use the Android Studio debugger to find and fix bugs in your code.

10. Keep your Android Studio installation up to date to ensure that you have access to the latest features and bug fixes.
Authorizing Docker Nugets
Published: 2023-01-06 21:17:30

**Problem**: 
Your docker container relies on a private nuget feed and you don't want to expose your credentials in the Dockerfile.

**Solution**:
Include an arg for the PAT token and inject that in when you build the docker container. Do this after you copy the config into the container, but before the restore.

```
COPY ["Nuget.Config", "."]

ARG PAT=nokeypassed
RUN sed -i "s|</configuration>|<packageSourceCredentials>
<Base><add key=\"Username\" value=\"PAT\" /><add key=\"ClearTextPassword\" value=\"${PAT}\" /></Base></packageSourceCredentials></configuration>|" Nuget.Config

RUN dotnet restore "<projfile>" --configfile Nuget.Config
```
CETVIRALL موقع خليج التقنية
Tags: download, apps, apk, android
Published: 2023-01-06 20:24:31


[CetVirall - خليج التقنية](https://cetvirall.com/) من افضل المواقع العربية الصاعدة المختص في تحميل الالعاب و التطبيقات المدفوعة مجانا بروابط مباشرة مع شروحات حصرية عن كيفية استخدامها و كذلك يضم الاخبار التقنية و مراجعة لاهم الهواتف و غيرها من الفقرات التي يزخر بها هذا الموقع المميز اذ يعد من افضل المواقع التقنية الصاعدة في الوطن العربي لكي لا اطيل عليكم اليكم رابط الموقع لزيارته و الاستفادة منه و هذه تصنيفات الموقع. 

الربح من الانترنت
العاب الاندرويد
العاب الايفون
تطبيقات الاندرويد
تطبيقات الايفون
تطبيقات القنوات والافلام
حسابات مجانية
سيرفرات IPTV
كتب PDF
منوعات تقنية
لا تتردد في زيارة موقع خليج التقنية الان وقم بتحميل العاب و تطبيقات الاندرويد والايفون مجانا [من هنا](https://cetvirall.com/).
AI and the panic of the white-collar worker
Tags: ai, chapgpt, openai, programming
Published: 2023-01-06 20:09:59

Words and art are arguably no more or less important or human than agriculture and craft. The difference between the powerloom and AI, perhaps, is the power and self-importance of those the technologies “disrupt”.

Since the dawn of the Industrial Revolution, there has been rage against the machine. From the first saboteurs in France, who tried to destroy power looms in the 17th century to the protests against mechanisation by labour unions and more recently, in the 1990s, against computerisation in India’s public sector by the CPM and Samajwadi Party — tech “disruptions” have led to deep churn in the nature of work. Yet, there is a tendency in the current moment — fed, perhaps, by the narcissistic hyperbole engendered by social media — to view the impending changes in labour and life by developments in artificial intelligence as especially apocalyptic.

Two AI-powered apps — ChatGPT and, to a lesser extent, Lensa — are the cause of a seeming moral panic around the nature of intellectual and artistic work. Since ChatGPT — an open-source AI-based text-generating tool — became public in December, everyone from writers, editors, academics to assorted white-collar professionals has been worried about jobs becoming obsolete and plagiarism becoming rampant. In fact, the bot’s creators, OpenAI, recently announced that they would create a watermark of sorts to ensure plagiarism can be easily detected. Lensa, on the other hand, creates stunning portraits with a subtlety hitherto thought to be an exclusively human domain, using AI.

The usual defence against the fear that AI will take over tasks that are fundamentally “human” is that no machine will be sophisticated enough to generate the pathos of a Dostoyevsky or the insight of a brilliant academic. The more important question, perhaps, is why upper-class passions and jobs are seen as more “fundamental” in the first place. When computers were used to replace accountants, or entire communities of weavers were lost to mass production, the human condition was not altered. Words and art are arguably no more or less important or human than agriculture and craft. The difference between the powerloom and AI, perhaps, is the power and self-importance of those the technologies “disrupt”.
Counter Styled & JavaScripted
Tags: codepen, html, css, javascript
Published: 2023-01-06 20:08:37

To say the least this is better than the one before. And so I must conclude that practice does make improvements in one's learning process. I now see what I did not conceive to understand before. Persistence is a needed quality to have when solo-learning..!

I understand now, how to use divs and shape them. They are more flexible and easier to control and work with. HTML all in all is much easier to get the hang of, it's like building a house from the ground up. I use border and background colours heavily when I am in the process of writing because I hate not seeing what I am doing. That's why I find CSS so frustrating at times. And the browsers are even more annoying since I cannot get my content displayed the way I've painstakingly built it in one place.

I think, as a beginner, I am not the only one that deals with that issue, where you spend two to three days on one project, getting everything else to work just fine, on one of these online editors and then when the finished project is transferred to the local editor hell breaks lose and you can't help but pull at your hair or bald skin, thinking why? why? why? is this happening to my project. 

It's a learning curve, I suppose, and the trick is to leave and then come back to it again when you have more understandings in your arsenal. Don't be shy or feel dumb for going back to basic or rewatching and refreshing your memory with stale knowledge that you have acquired at the beginning of your journey.

Now, this was suppose to be a two liner comment about the counter code that I have just finished here today, but it ended up becoming what you read. 

_And here I'll end with a sweep and say no more a beep, though I won't go to sleep._
Thank you for reading _this deep_. 

 It's the
_WILL-OF-DEE_
  

{% codepen https://codepen.io/djeylani/pen/OJwbZPE %}
Cloud Security: Como garantir a segurança de aplicações na nuvem?
Tags: cloud, security, devsecops, devops
Published: 2023-01-06 20:08:06

**Estar na nuvem é sinônimo de segurança?**

Quando o assunto é Cloud Security, muitos acreditam que armazenar dados na nuvem é sinônimo de garantir a segurança das aplicações.

No entanto, é preciso levar em consideração que existem muitas ameaças à segurança das aplicações na nuvem, como:

- Pontos de acesso mal configurados; 
- APIs públicas vulneráveis; 
- Ataques de negação de serviço (DoS Attack) e entre outras ameaças.

Por isso, é fundamental implementar soluções Cloud Security e estar sempre atento às melhores práticas de AppSec.

## Protegendo seus containers 

O uso de containers para o desenvolvimento de aplicações na nuvem pode apresentar alguns desafios de segurança, como vulnerabilidades relacionadas à exposição de portas e à falta de isolamento entre containers.

É importante ter medidas de segurança em mente para proteger os containers, como realizar a validação da segurança das imagens e configurar as políticas de segurança de acordo com as necessidades da aplicação e entre práticas.

## Criptografia como defesa dos dados

Uma das principais responsabilidades de quem desenvolve uma aplicação é a proteção de todos os dados que ela manipula. 

Por isso, é importante adotar medidas para garantir a segurança dos dados que são armazenados e processados na nuvem. Uma dessas medidas é a criptografia, que pode ser usada tanto para proteger dados em trânsito quanto para proteger dados armazenados. 

É fundamental ter uma estratégia de segurança bem definida e implementada para garantir a proteção dos dados da sua empresa.

## Monitoramento de seus microsserviços

Para garantir a segurança de uma aplicação na nuvem que utiliza microsserviços, é essencial implementar um processo de monitoramento constante das comunicações entre esses microsserviços. 

Isso permite detectar qualquer anomalia na troca de dados, ajudando a tomar medidas antes que a segurança da sua aplicação seja afetada.

O monitoramento também pode ajudar a identificar tentativas de acesso não autorizado ou outras ameaças importantes.

## Fique atualizado sobre Cloud Security

A nuvem é um ambiente em constante mudança e novas ameaças surgem a todo momento. Por isso, é fundamental manter-se atualizado sobre as melhores práticas de Cloud Security para garantir a proteção de sua aplicação.

As ferramentas de segurança utilizadas nem sempre conseguem acompanhar a evolução das novas estruturas.

**Lembre-se: a segurança da sua aplicação em nuvem depende de sua atenção e dedicação.** 

Acesse os nossos canais e fique atualizado com os principais tópicos sobre Segurança de Aplicações: https://bit.ly/3ifGhPd
What is ChatGPT, the AI that is in buzz and why everyone is talking about it
Tags: ai, openai, chatgpt, programming
Published: 2023-01-06 20:07:45

Say hello (literally) to the latest sensation in the technological world, ChatGPT: the AI that is taking the internet by storm and is making headlines for its astonishing capabilities.

In Short

- ChatGPT is developed by the Artificial Intelligence (AI) research company OpenAI.
- The chatbot understands natural language and responds in a human-like manner.
- ChatGPT was unveiled as a prototype on November 30,2022.



Gone are the days when Google and Wikipedia were the ‘cheat sheets’ that students used to rely upon while doing their homework. If you feel that you have been privileged to be born in the internet age, which made it so much easier to get through school and college, you’ll feel differently by the time you’ve read this entire article. Say hello (literally) to the latest sensation in the technological world, ChatGPT: the AI that is taking the internet by storm and is making headlines for its astonishing capabilities.
ChatGPT’s Popularity Boosts OpenAI’s Value To $29 Billion
Tags: openai, chatgpt, ai, programming
Published: 2023-01-06 20:04:58

ChatGPT developer OpenAI is reportedly considering a tender offer valuing the company at $29 billion, making it one of the most valuable US startups.

According to a report from The Wall Street Journal, research lab OpenAI, the developer of ChatGPT, is considering a tender offer that would value the company at around $29 billion.

The offer would involve purchasing a specified number of shares from existing shareholders at a fixed price and would roughly double OpenAI’s valuation from a previous tender offer completed in 2021, when the company was valued at around $14 billion.

The deal is reportedly being negotiated with venture capital firms Thrive Capital and Founders Fund. If it goes through it would make OpenAI one of the most valuable startups in the United States.

The significant increase in the company’s value is likely due in part to the widespread popularity of ChatGPT, which gained over a million users within the first five days of being made available to the public.

Given that OpenAI’s most popular product is offered for free, it may seem surprising that the company is valued so highly.

OpenAI generates millions in revenue by selling its AI software to developers. OpenAI is currently providing cloud services to Microsoft for tools that allow users to create text, code, and imagery using simple instructions.

Additionally, as a research organization, OpenAI is funded through a combination of donations, sponsorships, and grants.

Some of the sources of funding for OpenAI include companies like Microsoft and individual philanthropists such as Elon Musk and Sam Altman.

In 2019, Microsoft invested $1 billion in OpenAI, and the company has been discussing the possibility of making a much larger investment in the AI business, potentially worth tens of billions of dollars.

With further investment, OpenAI can work on integrating its AI technology with other Microsoft products.

This week, it was reported that Microsoft plans to incorporate AI technology from OpenAI’s ChatGPT chatbot into its Bing search engine.

ChatGPT integration will allow Bing to provide complete sentences in response to search queries rather than lists of links.

The updated search function is expected to be available by the end of March and can potentially give Microsoft an advantage over Google.

The tender deal has not yet been finalized, and the terms could change. OpenAI declined to comment on The Wall Street Journal’s report.
Most sophisticated embedding pattern in Go: embedded interface within a struct
Tags: webdev, programming, patterns, go
Published: 2023-01-06 20:03:39

From my point of view, this pattern is one of many explanatory examples, but should be learnt by heart until completely comprehended . It's like writing an explicit callback for another callback in JavaScript – takes time to make a final "Gotcha!"

```go
package main

import (
	. "fmt"
)

// 1.3) define interface siganture(s)
type Logic interface {
	Process (data string) string // # signature 1
	/* Argc (data []string) int  */// # signature 2 : keeping 2 as commented out 
}

// 1.1) empty struct is prerequisite to provide a method
type MethodProvider struct {
	isEmpty bool
}

// 1.2) thanks to empty struct above we can define method that will be our implicitly implemented Logic interface field i.e. Process in this case;
// Process method with returning type, in this case, it's a (labeled .......string)
func (methodReceiver MethodProvider) Process(data string) (methodReturnType string) {
	// business logic
	if !methodReceiver.isEmpty {
		Println(data)
	}
	return "methodReceiver that provides implicit Logic.Process signature implementation";
}

// DEV_NOTE: another struct embedding Logic.Process : we say Client "HAS" (i.e. "EMBEDS") Logic.Process not "IS" as embedding vs. inheriting is not the same !
type ClientProvider struct{
	LogicImplementor /* <= is an alias for => */ Logic /* interface */
}

// Program method with returning type, in this case, it's a .....string
func(clientReceiver ClientProvider) Program(pseudo_argv0 string) string {
 // get data from somewhere
	clientReceiver.LogicImplementor.Process("Client Process")
	return "Exit with pseudo code 0";
}

func main() {
	c := ClientProvider{
		LogicImplementor: MethodProvider{},
	}
	Println(c.Program("$PATH_TO_pseudo_argv0.exe"))
}
```

[runnable code example on REPLIT](https://replit.com/@projektorius96/interfaces#embedded-interf2--advanced.go)
> Open shell instance and type: `go run embedded-interf2--advanced.go` # <= this might change in the future so don't think hard, think smart !

---
<u>Related articles</u> :

- [understand-interfaces](https://duncanleung.com/understand-go-golang-interfaces/)

- [interfaces-in-structs: practical side of such embedding](https://eli.thegreenplace.net/2020/embedding-in-go-part-3-interfaces-in-structs/)

---

If you found any typo, or think you can suggest a better solution, please leave a comment below . Stay tuned !