teleren/devto huggingface dataset:
Next.js File Upload API Documentation
Tags: nextjs, fileupload, api, node
Published: 2023-11-20 04:32:04

This documentation provides a guide on setting up and using a file upload API in a Next.js application. The provided API endpoint allows you to handle file uploads efficiently.

## API Endpoint

The file upload API is defined in the POST handler, which is responsible for processing incoming file data and saving it to the server.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ty1ad6pws3xe6giuct2.png)


```
// Import necessary modules
import { NextResponse } from "next/server";**
import path from "path";
import { writeFile } from "fs/promises";

// Define the POST handler for the file upload
export const POST = async (req, res) => {
  // Parse the incoming form data
  const formData = await req.formData();

  // Get the file from the form data
  const file = formData.get("file");

  // Check if a file is received
  if (!file) {
    // If no file is received, return a JSON response with an error and a 400 status code
    return NextResponse.json({ error: "No files received." }, { status: 400 });
  }

  // Convert the file data to a Buffer
  const buffer = Buffer.from(await file.arrayBuffer());

  // Replace spaces in the file name with underscores
  const filename = file.name.replaceAll(" ", "_");
  console.log(filename);

  try {
    // Write the file to the specified directory (public/assets) with the modified filename
    await writeFile(
      path.join(process.cwd(), "public/assets/" + filename),
      buffer
    );

    // Return a JSON response with a success message and a 201 status code
    return NextResponse.json({ Message: "Success", status: 201 });
  } catch (error) {
    // If an error occurs during file writing, log the error and return a JSON response with a failure message and a 500 status code
    console.log("Error occurred ", error);
    return NextResponse.json({ Message: "Failed", status: 500 });
  }
};
```

## Usage
Uploading a File
To upload a file, make a POST request to the defined API endpoint with the file included in the request payload as a form data field named "file". The API handles the file processing and saves it to the server in the public/assets/ directory with a modified filename.

Example using fetch in JavaScript:
const fileInput = document.getElementById("fileInput"); // Replace with your HTML element ID

```
const file = fileInput.files[0];

const formData = new FormData();
formData.append("file", file);

fetch("/api/upload", {
  method: "POST",
  body: formData,
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));

```

## Response

The API returns JSON responses to indicate the success or failure of the file upload operation.

**Success Response (HTTP Status Code: 201 Created)**

```
{
  "Message": "Success",
  "status": 201
}
```

**Failure Response (HTTP Status Code: 500 Internal Server Error)**

```
{
  "Message": "Failed",
  "status": 500
}


```
how to setup aws cli
Published: 2023-11-19 18:44:48

In your browser, download the macOS pkg file: https://awscli.amazonaws.com/AWSCLIV2.pkg

Once installed, then:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zenl0g3ewth3kx16ubww.png)

Again:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hz46c2sxy3a8wdiuuz3y.png)


Finally, go to your AWS account and link your AWS account with your terminal (Mac OS):

1.- Click on upper right side to your user name, expand and click on Security Credentials

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wxpdtdfwexmzbg7okm7n.png)

2.- At this screen, click on create access key.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zyz3arcubnld8xv16fp0.png)

3.- Accept the message and proceed to create the key:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/razmyxgx9ip8m578djjp.png)

4.- You will receive a windows like this one:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rhv48g31aawfipopy4qe.png)

5.- Download the **.csv** file:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qvrys9s9ywaxbkqxi5ui.png)


6.- If you open the file, you will see something like this:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o99hcf3lxtyn2kb98lt7.png)

7.- Now, we have to configure our AWS CLI instance from our terminal, to link it with our AWS Account. Run the aws configure command:
7.1.- At the output format, please type json (lowercase):

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e16by6bcf3yska5hvh9n.png)

8.- This generates the ./aws directory with the given configuration:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7784qzzjjbwsygiexfq4.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7llozjvcfwi1m1i9nt5k.png)

9.- Test anything only to evaluate we can access to our aws account:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oflmjogzkay3upra48hw.png)
Game Development
Published: 2023-11-20 04:19:48

**Knick Global** is an innovative [game development](https://knickglobal.com/) platform that empowers creators worldwide to craft captivating, diverse, and immersive gaming experiences. With robust tools, collaborative features, and a vibrant community, Knick Global nurtures creativity and fosters the creation of engaging games across genres, inviting players into unique and thrilling virtual worlds.
The Value of Workshop Repair Manuals: Your Essential Guide to Efficiency
Published: 2023-11-20 04:16:10

In the realm of maintenance and repairs, a **[workshop repair manual ](https://downloadworkshopmanuals.com/)**stands as an invaluable asset, serving as the guiding light for individuals navigating the intricacies of fixing machinery, vehicles, or equipment. This comprehensive guide aims to unravel the significance, functionality, and benefits of these manuals, shedding light on their indispensable role in the world of repairs.

Understanding Workshop Repair Manuals
Workshop repair manuals are detailed documentation that encapsulate the essential information required to diagnose, troubleshoot, and repair a diverse range of equipment. They serve as an authoritative reference, encompassing schematic diagrams, step-by-step repair procedures, maintenance schedules, and technical specifications.

**Unveiling the Importance**
Precision and Accuracy
These manuals are meticulously crafted, offering accurate and precise information essential for effective repairs. They empower technicians, mechanics, and enthusiasts with the knowledge needed to tackle complex issues efficiently.

**Diverse Applications**
From automobiles to heavy machinery and electronic devices, workshop repair manuals cater to a wide spectrum of industries and equipment types. They cater to both professionals and DIY enthusiasts, enabling them to enhance their understanding and skills in the realm of repairs.

**Benefits Galore**
**Enhanced Troubleshooting**
With detailed troubleshooting guides, these manuals streamline the identification of problems, aiding in swift and accurate diagnosis. They facilitate the process of pinpointing issues, thereby reducing downtime.

**Cost-Efficiency**
By empowering individuals to undertake repairs independently, workshop repair manuals mitigate the need for frequent professional assistance, ultimately saving on repair costs.

**Maintenance Guidance**
Beyond repairs, these manuals provide comprehensive maintenance schedules, ensuring equipment longevity and optimal performance. They guide users on preventive measures to avert potential breakdowns.

**Evolution in the Digital Age**
With technological advancements, workshop repair manuals have transitioned into digital formats. Online repositories, downloadable PDFs, and interactive platforms have revolutionized accessibility, making information readily available to a global audience at their fingertips.

**Conclusion**
In essence, workshop repair manuals represent an indispensable cornerstone in the realm of repairs and maintenance. Their evolution, from traditional print to digital formats, has revolutionized accessibility and usability, empowering individuals with the knowledge needed to tackle repairs effectively.

Whether you're a seasoned professional or an enthusiastic DIYer, embracing the insights provided within these manuals can undoubtedly elevate your repair proficiency, enabling you to conquer challenges with confidence and expertise.
Best React JS Training in Bangalore | AchieversIT
Tags: bestreactjstraininginbangalore
Published: 2023-11-20 04:00:13


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t9jy314byh6qaex0z6z9.png)
When it comes to acquiring top-notch skills in React JS, AchieversIT stands out as the leading training institute in Bangalore. Aspiring web developers and tech enthusiasts looking for the best React JS training in Bangalore need not look any further. Our institute has established a reputation for providing comprehensive and highly effective React JS courses that empower individuals to excel in the world of web development.
The React JS training at AchieversIT is meticulously designed to cater to both beginners and experienced developers. Our courses cover everything from the fundamentals to advanced topics, ensuring that each student gains a strong foundation and the ability to tackle real-world projects with confidence
[https://www.achieversit.com/react-js-training-in-bangalore](https://www.achieversit.com/react-js-training-in-bangalore)
Metric Gaming partners with JAMBOS
Published: 2023-11-20 03:33:48

Metric Gaming, a multi-tenant B2B sports betting services provider, has partnered with JAMBOS, pioneers in US Sports Analytics, to collaborate across a variety of projects.

While the emphasis of the partnership is to capitalize on opportunities presented by the emerging US market, both companies recognized a commercial potential to the partnership on both sides of the Atlantic.

Martin de Knijff, CEO at Metric Gaming, said: “We aim to work with leaders in their respective fields and in JAMBOS, Metric has partnered with very best. JAMBO’s track record of capitalizing on unique opportunities identified through astute sports analytics fits seamlessly with Metric’s ethos and the partnership is already creating new opportunities we are excited to capitalize on.”

Commenting on the partnership, Michael Schwimmer, CEO at JAMBOS, said: “We have been actively looking for the right partner to collaborate with in this space and we have been impressed by the possibilities of Metric’s modern technology platform. We are thrilled to be able to leverage our unique expertise in this industry and are excited by the potential of this partnership.”

This announcement follows recent news of Metric Gaming’s partnership with US based company Sports IQ to provide a one stop service for US sports betting products to the industry in early 2020. [바카라사이트](https://www.casinosite24.com/)

With the repeal of PASPA in May 2018, individual states across the US have been introducing legislation to allow legal sports betting. This has created a flurry of US centric activity across the industry as domestic and international operators jostle to get a foothold in the nascent market.
Google FireStore Data Source Plugin for Grafana.
Tags: showdev, opensource, github, database
Published: 2023-11-20 03:32:29

#firestore-grafana-datasource

[Google Firestore](https://cloud.google.com/firestore) Data Source Plugin for [Grafana](https://grafana.com/).

Grafana Firestore Data Source Plugin enables integrating data on Firestore on to Grafana dashboards.

It uses [FireQL](https://github.com/pgollangi/FireQL) to capture user query that translated to issue queries on Firestore and construct results.

> [FireQL](https://github.com/pgollangi/FireQL) is a Go library to query Google Firestore database using SQL syntax.


## Features
- Use Google Firestore as a data source for Grafana dashboards
- Configure Firestore data source with GCP `Project Id` and [`Service Account`](https://cloud.google.com/firestore/docs/security/iam) for authentication
- Store `Service Account` data source configuration in Grafana encrypted storage [Secure JSON Data](https://grafana.com/docs/grafana/latest/developers/plugins/create-a-grafana-plugin/extend-a-plugin/add-authentication-for-data-source-plugins/#encrypt-data-source-configuration)
- Query Firestore [collections](https://firebase.google.com/docs/firestore/data-model#collections) and path to collections
- Auto detect data types: `string`, `number`, `boolean`, `json`, `time.Time`
- Query selected fields from the collection
- Order query results
- Limit query results
- Query [Collection Groups](https://firebase.blog/posts/2019/06/understanding-collection-group-queries)

### Firestore data source configuration


![Firestore data source configuration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yllfipep0sqv7rwvbh7e.png)

### Using datasource 

![Using datasource](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m73sh0gm35t030ovjuaz.png)
AHUI.VN Chiết khấu taobao 1688 pinduoduo
Tags: webdev, programming, react, tutorial
Published: 2023-11-20 03:28:50

AHUI.VN là hệ thống nhận chiết khấu taobao 1688 pinduoduo. Nhận hoàn tiền mua sắm taobao, 1688, pinduoduo hoàn toàn tự động. Tỷ lệ chiết khấu cao nhất Việt nam

Sđt: 989543464

Địa chỉ : 31 Na Làng, Cao Lộc, tỉnh Lạng Sơn

http://ahui.vn/
Pragmatic Play Releases its Next Hit – Auto Mega Roulette
Published: 2023-11-20 02:55:10

Pragmatic Play has issued another hot title, which promises tons of potential and countless entertainment hours for fans of roulette. In its latest press, the iGaming provider unveiled Auto Mega Roulette, which is a sequel to one of its top-performing gameshows, Mega Roulette. The new Live Game removes the dealer and spins the wheel automatically.

The company is one of the most reliable and innovative creators of online gaming content in the industry, as it boasts an impressive collection of Slots, Live Games, Virtual Sports, and Bingo games. Its multi-product portfolio is available through one single API, and every month the developer launches up to eight new slot titles for its operator partners. [바카라사이트](https://www.casinositezone.com/)

Breaking Down the New Title

Presenting the latest Mega Roulette iteration – a thrilling gameshow without a dealer, where the wheel spins automatically. Its rapid pace creates an exciting experience for players. After bets are placed, the game randomly selects one to five Mega Lucky Numbers. When the ball settles, the chosen lucky number is revealed, and players receive payouts based on the standard roulette table.

The game comes with the exhilarating Mega Round, adding an extra level of excitement. Once triggered, Mega Multipliers come into play, updating the total payout. A winning bet can yield between 50x to 500x the player’s initial wager. This product allows operators to customize the branding, creating a distinctive and tailored environment. It offers an unparalleled Live Casino experience that perfectly complements the dynamic nature of the game.

The release of the new iGaming titles further expands the studio’s library of engaging Live Casino games. It touts some leading titles such as Sweet Bonanza CandyLand™ and the new Snakes & Ladders Live™ alongside players’ favourite casino classics such as Blackjack and Roulette. Its vertical has proven to be quite the hit among online players.

Irina Cornides, COO of the company, commented that the new roulette game is a thrilling, high-octane gameshow, which puts a new take on the provider’s Live Casino hit with the added fun of Mega Rounds. She noted that the new offering will add a new dimension to the supplier’s offerings, while also upping Live Casino experiences for the company’s many operator partners.

Busy in 2023

This year, Pragmatic Play has worked and signed off some impressive partnerships to expand across more regulated markets for iGaming. In May 2023, it announced a collaboration with Bet365 providing the leading operator with its Live Casino vertical for Ontarians. Bet365 is one of the many licensed operators to offer iGaming in the province’s open digital sector.

Then in July 2023, the company also inked a contract to partner up with Peppermill Casino in Belgium. Via the terms of this deal, the prominent provider has accepted to distribute its library of first-in-class dice slots to the gaming brand. This will feature titles such as Sweet Bonanza Dice™, The Dog House Dice™, and Snakes & Ladders Megadice™.
Javascript Data structure
Tags: javascript, datastructures, interview
Published: 2023-11-20 02:49:30

               **  Javascript Data structure **
                       (Big O Notation)
Time Complexity
    O(1): no matter how big the job is, it takes the same amount of time to complete. It's like saying, "It's a one-size-fits-all speed, and the size of the task doesn't matter."
    O(n): If you have a process with O(n) complexity, doubling the size of the input will roughly double the time it takes to finish the task. It scales linearly with the input size.
![Time Complexity javascript Datastructure example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2qmhz924k9a8glu2brm.png)

Space Complexity
O(1) space complexity: This means that the amount of memory used by an algorithm or operation remains constant, regardless of the size of the input data. It's often considered very efficient because the memory usage doesn't grow as the input size increases.

O(n) space complexity: This means that the amount of memory used by an algorithm or operation grows linearly with the size of the input data. As the input size increases, the amount of memory used also increases proportionally.


![Space Complexity javascript Datastructure example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6tlvcwmsiv0q23jkrd9x.png)
My freelancing experience with Laravel + GraphQL Part 2: How to use Query/Mutation in frontend with React.js
Published: 2023-11-20 02:45:03

---
title: My freelancing experience with Laravel + GraphQL Part 2: How to use Query/Mutation in frontend with React.js
published: true
description: 
tags: 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/clsmqgo1ogo5tc4sv0jc.png
# Use a ratio of 100:42 for best results.
# published_at: 2023-11-20 02:42 +0000
---

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/clsmqgo1ogo5tc4sv0jc.png)

In the previous article, I introduced the strength of GraphQL and how to implement it in Laravel

Let's talk about how to use it in frontend with React.js today!

## Example project and API playground

I implemented an e-commerce sample project with graphql + laravel in the previous post

https://graphql-laravel-example.tw/graphiql

I created a simple e-commerce frontend with Next.js this time

https://graphql-react-example.vercel.app/

You can browse products & subscribe the newsletter in the web app!

---

For `graphql query` sample code:

https://github.com/howtomakeaturn/graphql-react-example/blob/main/app/page.js

For `graphql mutation` sample code:

https://github.com/howtomakeaturn/graphql-react-example/blob/main/app/newsletter.js

I use the native `fetch` function to call graphql api, so you should be able to do it with any http libraries.

And I use `swr` library (Next.js official library) as state manager, but any state manager should be fine.


## Strengths

The best part about graphql is frontend devs can decide what data should be returned!

Frontend devs can try & see the results with the powerful graphql playground

https://graphql-laravel-example.tw/graphiql

Even relational data can be returned easily!

```
const gql = `query {
  products {
    id
    name
    description
    featured_image
    price
    comments {
      content
      user {
        name
      }
    }
  },
}`;
```

It reduces devlopment time and communication time a lot!

## Source code

React source code

https://github.com/howtomakeaturn/graphql-react-example

Laravel backend sample project

https://graphql-laravel-example.tw/

Laravel backend source code

https://github.com/howtomakeaturn/graphql-laravel-example

## Conclusions

With the above example projects,

You should be able to implement your own graphql APIs in your project!

I will realease more sample code in the following articles, you should definitely give graphql a try!

(This is series article. More content will be released soon.)
Exploring the Wonders of Remini Photo Editing App
Published: 2023-11-20 02:23:29

Introduction:
In the dynamic landscape of digital image enhancement, Remini emerges as a noteworthy player, offering a unique perspective on photo restoration and editing. This article explores the distinctive features and functionalities that set Remini apart, focusing on its ability to breathe new life into photographs through advanced AI technology.
Understanding Remini:
Remini is not just another photo editing app; it specializes in the enhancement and restoration of old, blurred, or low-resolution images. What sets it apart is the use of cutting-edge deep learning algorithms that analyze and reconstruct images, resulting in clearer, sharper, and more vibrant pictures.
Key Features:
Remini boasts a range of features that make it a standout choice. First and foremost is its prowess in enhancing clarity and sharpness. Whether dealing with blurry shots or low-resolution images, Remini algorithms excel at bringing details into sharper focus. Additionally, the app is adept at breathing new life into old photographs, revitalizing colors, and restoring the essence of cherished memories.
Artificial Intelligence Magic:
At the core of Remini effectiveness is its utilization of artificial intelligence. The app intelligently analyzes the unique characteristics of each photo, tailoring its enhancements to the specific needs of the image. This personalized touch ensures a more effective and nuanced enhancement, making Remini a powerful ally in the quest for perfect pictures.
User-Friendly Interface and Real-Time Processing:
[Remini Mod Apk](https://gbnine.com/remini-mod-apk/) user-friendly interface caters to both novice and experienced users, ensuring a seamless editing experience. Moreover, the app operates with impressive speed, providing real-time processing of images. This means users can witness the transformation of their photos almost instantly, adding an interactive element to the editing process.
Social Sharing and Subscription Model:
Once the editing journey is complete, Remini simplifies the sharing process with direct integration with various social media platforms. Whether it's a meticulously restored old photo or a newly enhanced snapshot, users can share their creations effortlessly. While Remini offers a free version with basic features, its subscription-based model caters to those seeking premium enhancements and additional features. This model not only supports ongoing app development but also ensures a continually improving user experience.
Conclusion:
In conclusion, Remini focus on restoration and enhancement, particularly for images suffering from blurriness or low resolution, makes it a powerful tool in the realm of photo editing apps. With its powerful AI algorithms, user-friendly interface, real-time processing capabilities, and seamless integration with social media, Remini offers a simple yet potent solution for elevating visual memories. Whether you're a photography enthusiast or someone with a collection of treasured old photographs, Remini stands ready to revive and amplify your images, bringing a touch of magic to your visual storytelling.