teleren/devto huggingface dataset:
Demystifying JavaScript Functions: A Guide to Function Types
Tags: javascript, webdev, beginners
Published: 2023-05-26 15:58:51

In JavaScript, there are several types of functions, including:

## 1- Function declarations
A function declaration defines a named function using the function keyword and can be called anywhere in the code.

```js
function addNumbers(a, b) {
  return a + b;
}

console.log(addNumbers(2, 3)); // logs 5
```

---

## 2- Function expressions
A function expression defines a function as part of an expression, such as assigning a function to a variable.

```js
var multiplyNumbers = function(a, b) {
  return a * b;
};

console.log(multiplyNumbers(2, 3)); // logs 6
```

---

## 3- Arrow functions
Arrow functions are a shorthand syntax for defining functions using the => arrow operator. They are often used for concise one-line functions.

```js
var divideNumbers = (a, b) => a / b;

console.log(divideNumbers(6, 3)); // logs 2
```

---

## 4- Immediately invoked function expressions (IIFE)
An IIFE is a function that is defined and called immediately. It is often used to create a new scope for variables and avoid polluting the global namespace.

```js
(function() {
  var message = "Hello, world!";
  console.log(message);
})();
```

---

## 5- Methods
Methods are functions that are defined as properties of an object. They can be called using theobject and dot notation.

```js
var calculator = {
  add: function(a, b) {
    return a + b;
  },
  subtract: function(a, b) {
    return a - b;
  }
};

console.log(calculator.add(2, 3)); // logs 5
console.log(calculator.subtract(5, 2)); // logs 3
```

---

## 6- Constructor functions
Constructor functions are used to create new objects of a specific type, often referred to as classes. They use the this keyword to set properties of the new object and are called using the new keyword.

```js
function Person(name, age) {
  this.name = name;
  this.age = age;
}

var alice = new Person("Alice", 25);
console.log(alice.name); // logs "Alice"
console.log(alice.age); // logs 25
```

---

## 7-Callback functions
Callback functions are functions that are passed as arguments to another function and called when the other function completes. They are often used for asynchronous programming, such as handling events or making API calls.

```js
function getData(callback) {
  // make API call and return data
  var data = {name: "Alice", age: 25};
  callback(data);
}

function displayData(data) {
  console.log(data.name + " is " + data.age + " years old.");
}

getData(displayData);These are some of the common types of functions in JavaScript, and each has its own use case and advantages.
```
어려울 때 진짜 모습이 나온다
Published: 2023-05-26 15:56:45

조직 안에서 "어떠세요?"라고 물어보면
- "사람들이 너무 좋아요"
- "조직 문화가 좋아요"
- "수평적이어서 좋아요"
- "모두가 다 열심이어서 좋아요"
같은 이야기들이 나온다. 이런 이야기들이 나쁘진 않은데, 이런 말들은 조직 상황이 좋으면 다 좋을 수 밖에 없다. 이 세상에 상황이 나쁘지 않은데 굳이 좋지 않은 모습을 보일 이상한 사람들은 많지 않다. 

그런데 조직과 개인의 진짜 모습은 상황이 어려울 때 나온다. 이런 이유에서 좋은 상황에서의 좋은 모습들을 믿으면 안 된다. 굳이 의심해야 한다는 이야기는 아니지만, 적어도 최소한, 확인되지 않은 좋은 모습이 그 조직에 있어야 할 이유가 되어선 안 된다는 것이다. 

조직 상황이 좋든 싫든, 조직 전체 목표 달성을 위해 모두가 진심이고 열심을 다 할 땐, 마냥 좋을 수 없는 경우가 많다. 조직 안에서 너무 너무 행복하기만 하다면, 무언가 착각하고 있거나 아니면 진짜 모습들을 보지 않아서일 수 있다.
Unleash the Power of JavaScript: Master the Best Practices and Write Top-Notch Code
Tags: javascript, webdev
Published: 2023-05-26 15:36:37

## 1- Use const and let instead of var
Const declares a variable whose value cannot be changed. Let has block scope instead of function scope like var. Using const and let improves readability and avoid bugs.

```javascript

const myName = "Mohammad";
myName = "Ali"; // Error, can't reassign const

let myAge = 30; 
if (true) {
  let myAge = 40;  // Different variable
  console.log(myAge); // 40
}
console.log(myAge); // 30
```

---

## 2- Avoid global variables
Global variables can lead to namespace collisions and unintended side effects in large apps. Use local variables instead.

---

## 3- Use arrow functions
Arrow functions have a shorter syntax and lexically bind the this, arguments, super, and new. Target keywords.

```js
// An Arrow function
const add = (a, b) => a + b;

// A function declaration
function add(a,b)=>{
   return a+b
};
```
---

## 4- Use spread operator
The spread operator expands an array into its individual elements. It is a concise way to combine arrays or objects.

```js

const fruits = ["apple", "banana", "orange"];
const moreFruits = [...fruits, "mango"]; 

console.log(moreFruits) // ["apple", "banana", "orange", "mango"]

```

---

## 5- Use destructuring
Destructuring allows you to extract multiple values from arrays or properties from objects into distinct variables.

```javascript

const [a, b] = [1, 2]; 
// a = 1, b = 2

const {name, age} = {name: "Omar", age: 30}; 
// name = "Omar", age = 30

```

---

## 6- Use template literals
Template literals use backticks () and `${}` to embed expressions in a string.

```javascript
const greeting = (name) => return `Hello, my name is ${name}!`;
```
---

## 7- Use default parameters
Default parameters allow named parameters to be initialized with default values if no value is passed.

```javascript
const add = (a = 1, b = 2) => return a + b; 

add(10); // 12
```

---

## 8- Use object property shorthand
This shorthand allows you to initialize an object with variables.

```javascript
const name = "Ahmed";
const age = 30;
const person = { name, age }; 
// {name: "Ahmed", age: 30}
```


---

## 9- Use promise and async/await
Promises and async/await make asynchronous code look synchronous and more readable.

---

## 10- Use JavaScript modules
Modules allow you to break up your code into separate files and reuse in other files or projects.
Improving Our Project’s UI
Published: 2023-05-26 15:36:02

As developers, we often focus on the technical aspects of our projects, and the user interface (UI) can sometimes be overlooked. However, we know that a well-designed UI is crucial to the success of any software project. Therefore, we decided to take a closer look at the UI of our project and see how we could improve it.

Our initial UI design was quite complex, with many different elements and features. While this design looked impressive on paper, we soon realized that it was overwhelming for the user and caused confusion. We knew we had to simplify the design and make it more user-friendly.

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

To begin the process, we conducted an analysis of our project’s features and identified the essential ones. We then created a new UI design that focused only on these critical features, removing anything that was not necessary. This new design was much simpler, with a cleaner layout and fewer distractions.

We also considered the user experience (UX) when designing the new UI. We wanted to make sure that the user could navigate the interface easily and find the features they needed quickly. We achieved this by creating clear and concise labels and organizing the UI in a logical way.

Once we had a new design in place, we tested it thoroughly to make sure that it was both aesthetically appealing and functional. We made a few minor adjustments based on our testing, but overall, the new design was a significant improvement over the previous one.

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

In conclusion, we learned that a clean and simple UI design is essential to the success of any project. By focusing on the critical features and designing a logical and user-friendly interface, we were able to create a UI that was both aesthetically pleasing and functional. We are confident that this new design will provide a better user experience and improve the overall success of our project.
What was your win this week?
Tags: discuss, weeklyretro
Published: 2023-05-26 15:33:01

---
title: What was your win this week?
published: true
description: Looking back on this past week, what was something you were proud of accomplishing?
tags: discuss, weeklyretro
---

Hey folks 👋

Hope that y'all all enjoy your weekends. 

Looking back on this past week, what was something you were proud of accomplishing?

All wins count — big or small 🎉

Examples of 'wins' include:

- Starting a new project
- Fixing a tricky bug
- Visiting with friends 🙌

---

![Lisa Simpson dancing](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/to9g5h68py6qwy3oml3y.gif)
How to add auth system to Express.js
Tags: javascript, backend, tutorial, productivity
Published: 2023-05-26 15:28:54

Sometimes you have **great** app idea, but you need to make authentication. Without further ado, I'll show you how to do it.

## Part 1
Let's assume you have installed `express` and now you need to:
```shell
npm i body-parser cookie-parser
```
Now you need to make file called `accounts.json`
Replace content of `accounts.json` file with this:
```json
[
  {
    "name": "user",
    "password": "user",
    "data": "I'm user"
  },
  {
    "name": "user2",
    "password": "user2",
    "data": "I'm second user"
  },
  {
    "name": "user3",
    "password": "user3",
    "data": "I'm third *special* user"
  }
]
```
**⚠ This is only example. Storing unhashed passwords is dangerous. If you know how to use databases you can use database.**

## Part 2
Now you need to have accounts list in an object and have sessions array.
Add this lines below `const app` in your `index.js`
```js
const accounts = require("accounts.json")
const sessions = {};
app.use(bodyParser.urlencoded());
app.use(cookieParser());

function randomSID() {
    var sID = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15)
    if(!sessions.hasOwnProperty(sID)){
        return sID;
    }
    return randomSID();
  }
```

## Part 3
Create an `/login` API endpoints.
```js
app.get('/login', (req,res)=>{
  res.send(`
<form type="post">
<input name="name">
<input name="password" type="password">
<button type="submint">Log In</button>
</form>
`)
})
app.post('/login', (req,res)=>{
  if(accounts.find(x=>x.name == req.body.name && x.password == req.body.password){
    const newSessionID = randomSID()
    res.cookie('sID', newSessionID)
    sessions[newSessionID] = accounts.findIndex(x => x.name === 
    body.name && x.password === body.password)
    res.redirect('/')
  }
  else {
  res.send("Bad password")  
  }
})
```
Create logout API endpoint:
```js
app.get('/logout', (req, res) => {
  delete loggedInSessions[req.cookies.sID]
  res.clearCookie('sID')
  res.redirect('/')
})
```
## Part 4
Create an account middleware
```js
function accountMiddleware(req,res,next){
  if(accounts[sessions[req.cookies.sID]]){
    req.account = accounts[sessions[req.cookies.sID]]
  }
  else {
    req.account = null;
  }
  next()
}
```
Also add this line next to `app.use`'s.
```js
app.use(accountMiddleware)
```
## Part 5
Now you can easily get account data using `req.account`.
Example endpoint:
```js
app.get('/', (req, res) => {
  if(req.account){
    res.send(`You are logged in as ${req.account.name} and here is your data: ${req.account.data}`)
  }
  else {
    res.send("You are logged out")
  }
});
```
Google Analytics Tag using Astro
Published: 2023-05-26 15:21:10

If you are using Astro and want to add Google Analytics with the copy/paste version provided by Google itself, which is the following.

```html
    <!-- Google tag (gtag.js) -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-V"
    ></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag() {
        dataLayer.push(arguments);
      }
      window.gtag = gtag;
      gtag("js", new Date());

      gtag("config", "G-V");
    </script>
```

Just note that Astro by default would convert the second `script` tag without any attributes to a `module` type meaning that the function `gtag` would be scoped to that single `script` tag. 

The fix is super simple, just remember to add `type="application/javascript"` so that Astro doesn't infer the script tag to a `module` one.

```html
<!-- first script tag -->
<script type="application/javascript">
```

Thanks for reading!

Follow me on Twitter, [@tonadev](https://twitter.com/tonadev)

> Photo by <a href="https://unsplash.com/@jtzanno?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Joao Tzanno</a> on <a href="https://unsplash.com/photos/G9_Euqxpu4k?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
Visualizing the Impact of Code Changes
Tags: opensource, ci, cli
Published: 2023-05-26 15:07:18

Have you ever encountered a problem where modifying your code inadvertently affected other parts of your program? I have been working on the development of an open-source static analysis tool called [Inga](https://github.com/seachicken/inga). Its purpose is to automate the visualization of API endpoints and UI components influenced by code changes in a continuous integration (CI) environment.

## What is AST?

To better understand how code analysis works, let's start by discussing the concept of an Abstract Syntax Tree (AST). When working with code, it is challenging to identify code references and analyze the structure solely based on characters. Therefore, before performing code analysis, we convert the code into AST, which represents the code's structure in a tree-like format.
AST contains the following essential data:

- Type (e.g., class, method)
- Name
- Code range
- Child nodes

## How to find the Impact of Code Changes

Now, let's explore how we find the affected code changes using AST. Two key aspects are to consider: definitions (such as methods or members) and references. We compare the code and the AST.

### Find Definitions

{% embed https://gist.github.com/seachicken/2fec3fd4322d935356cdaccc82fdccf2 %}

For example, if we make a code change within the block of the `create` method, we can locate the affected definition by examining the start and end text positions of the corresponding AST node.
However, finding references is more complex. Since `create` can be defined in multiple places within a project, we cannot rely on a simple search.

| | process | found name |
|--|--------|------------|
| 1 | Get package node name | app.service |
| 2 | Get class node name | app.service.Order |
| 3 | Get method node name | **app.service.Order.create** |

### Find References

{% embed https://gist.github.com/seachicken/d7d39584286462971ff3a16af7c645b1 %}

To find the method invocation, we search for a specific type of AST node that corresponds to the method call. In this case, we are looking for a node that matches the target method name `create`, which we have just searched for. From there, we can traverse the tree upwards to determine the class name and eventually obtain the unique name "app.service.Order.create," which is associated with the target definition.

| | process | found name |
|--|--------|------------|
| 1 | Find the `create` method call | create |
| 2 | Find the class definition of the `order` member | Order.create |
| 3 | Find imports for `Order` | **app.service.Order.create** |

## Conclusion

We can determine the entry points of call references by utilizing a cyclomatic approach to identify unique names within both definitions and references. This analysis technique allows us to work with projects written in multiple languages such as Java and Kotlin.
Inga is currently under development. If you find this tool interesting, please consider giving it a star ⭐️ and providing feedback. Thank you!

{% embed https://github.com/seachicken/inga %}
How to work with Elasticsearch 8 using Spring Boot 3 and Spring Data Elasticsearch 5.x
Published: 2023-05-26 15:05:34

Hi, Java-Spring Boot-Elasticsearch fans

Despite that Elasticsearch was upgraded from 7th to 8th version almost 2 years ago, Spring Boot and Elasticsearch package was adjusted to it relatively recently. When I had to upgrade my project to Elasticsearch 8 version with using spring boot 3 and last spring data Elasticsearch version - I've met a lot of difficulties. Mostly because of 2 main reasons:

- too many changes appeared at how Elasticsearch queries are built since Spring Data Elasticsearch 5.x version

- lack of good examples at internet, which impressed me a lot

As result I decide to share here some examples, which can be helpful for somebody at his upgrade path

1.Example with range query

Here how it was at previous version Spring Data Elasticsearch versions (3d and 4th):


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

Here how it looks since Spring Data Elasticsearch 5.x :


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

2.Example with bool query to create OR condition with match queries

Here how it was at previous version Spring Data Elasticsearch versions (3d and 4th):

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

Here how it looks since Spring Data Elasticsearch 5.x :


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

The main thing that was changed is the approach of getting builders. Previously we had universal QueryBuilders class from which we got builders for different types of Elasticsearch queries. From 5x version builders are moved inside Elasticsearch “query” classes. If you are interested at more examples, please visit according article at my blog: "[How to work with Elasticsearch 8 using Spring Boot 3](https://sergiiblog.com/how-to-work-with-elasticsearch-8-using-spring-boot-3-x-and-spring-data-elasticsearch-5-x/)"
Writing Simple RestAPI in Nim With HappyX #3
Tags: happyx, nim, tutorial, api
Published: 2023-05-26 14:58:59

Hi there 👋!

Previously we add posts getting 🙂.

Now we implement post adding ✌.

At first go into `src/main.nim` and add Request Model
```nim
import
  # This will import HappyX framework
  happyx

# Request model AddPost
# with two string fields
model AddPost:
  title: string
  text: string
```

After this let's create post addition method 🍍
```nim
  # on POST HTTP method at 127.0.0.1:5000/post/
  post "/post/[postData:AddPost]":
```
Here we use `AddPost` as `postData` immutable var 🎈

Let's add sended post into `posts` variable
```nim
  # on POST HTTP method at 127.0.0.1:5000/post/
  post "/post/[postData:AddPost]":
    posts.add(%*{
      "title": postData.title,
      "text": postData.text
    })
```
Here we convert `AddPost` model to [`JsonNode` object](https://nim-lang.org/docs/json.html#JsonNode) and add it into our posts

Let's says user about post successfully added into our posts ✨
Just add `return` statement
```nim
  # on POST HTTP method at 127.0.0.1:5000/post/
  post "/post/[postData:AddPost]":
    posts.add(%*{
      "title": postData.title,
      "text": postData.text
    })
    return {"response": {
      "index": posts.len - 1
    }}
```

You can test it into [postman](https://www.postman.com/) ✌
URL: `http://localhost:5000/post/`
Method: POST
JSON raw body:
```json
{"title": "Your title", "text": "your text"}
```

And try to open `http://localhost:5000/posts` after adding post 👀

That's all! Good luck ✨

[Source code](https://github.com/HapticX/happyx-tutorial-series/tree/91c8b0b18a6927ca321b64e91035daddcec8a892/simple_rest_api)
Can't avoid boilerplate? Use template project
Tags: github, softwareengineering, programming
Published: 2023-05-26 14:57:59

พอเราเขียนโค๊ดไปสักพักนึง เราจะเริ่มเขียนโปรเจคจำนวนนึงที่แบบ...มันดูคล้าย ๆ กัน มีโค๊ดที่หน้าตาเหมือน ๆ กัน ใช้ไลบราลีตัวเดียวกัน คือจุดเริ่มต้นมันเหมือนกัน แล้วมันค่อย ๆ โตไปเป็นโปรแกรมที่มีวัตถุประสงค์ที่แตกต่างกันในอนาคต

เช่นแบบ เวลาเราทำโปรเจคที่เป็น React (สมมติ) เราก็ต้องมา import library เพิ่มทาสก์ใน `package.json` ต้องเขียนโค๊ดที่หน้าตาคล้าย ๆ กันจำนวนนึง จนกระทั่งมันรันขึ้นแล้วเราค่อยมาแก้ไขให้มันเป็นแอพลิเคชั่นที่เราต้องการ อะไรแบบนี้ใช่ไหมครับ 

วิธีนึงที่จะมาช่วยคือสร้าง tool ที่ generate project file ทั้งหมด ซึ่งเป็นวิธีที่หลาย ๆ เฟรมเวิร์คใหญ่ ๆ ใช้ (React ก็ด้วย) เรียกว่ารันคอมมานด์แล้ว ใส่คำสั่งนิดหน่อย ก็ได้แอพรันขึ้นมาแล้ว

```
npx create-react-app my-app
cd my-app
npm start
```

แต่อีกวิธีที่เรียบง่ายกว่านั้นคือ สร้างเทมเพลตสำหรับโปรเจคขึ้นมา เวลาจะสร้างโปรเจคใหม่ก็แค่ก็อปปี้เทมเพลตออกมาเป็นโปรเจคใหม่ แล้วก็แก้ไขโปรเจคนั้นให้ตรงกับความต้องการของเรา

# Template Project ใน GitHub
ใน Github เองมีฟีเจอร์นี้อยู่ครับ เราสามารถสร้างโปรเจคขึ้นมาแล้วระบุว่าโปรเจคนี้เป็น Template ในหน้า Settings ของโปรเจค

![ติ๊กถูกที่ช่อง Template repository](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xiz7vmsh9ov6e0hcd2fx.png)

แค่นี้โปรเจคนี้ก็จะกลายเป็นเทมเพลตของเราเรียบร้อย

จากนั้น เมื่อเราต้องการจะสร้างโปรเจคใหม่ เราก็แค่เลือกเทมเพลตใน dropdown ตอนสร้าง repository 

![เลือกเทมเพลต](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3wdnd8pkadcqncbckrgu.png)

หรืออีกทางเลือกหนึ่งคือ เปิดหน้า repository ของเทมเพลตที่จะใช้ แล้วกด "Use this template"

![Use this template -> Create a new repository](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sgm1yg1nu5lopj6kzy9c.png)

เมื่อ Repository ถูกสร้างเรียบร้อย เราจะได้ repository ใหม่ที่หน้าตาเหมือนกับตัวเทมเพลตเป๊ะ ๆ โดยที่เราไม่ต้องมานั่งก็อปปี้ไฟล์ไปมา

![โปรเจคใหม่](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjnrn73vdtnjoc569toc.png)

![เทมเพลต](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r3t916j3wl3cgprg2y9w.png)

สิ่งที่แตกต่างคือ ตัวหัวโปรเจคจะระบุไว้ว่าสร้างจากเทมเพลตไหน และโปรเจคใหม่ที่สร้างขึ้นมาจะมีสถานะเป็นเหมือนโปรเจคใหม่ที่มี commit แรกจากตัวเทมเพลต ไม่มี branch ไม่มี history ที่ติดมาจากตัวเทมเพลต เรียกได้ว่าเริ่มต้นกันแบบคลีน ๆ ครับ

ทั้งนี้ ถ้าเกิดว่าตัวเทมเพลตเรามี GitHub Action อยู่ เมื่อเราสร้าง repository ใหม่ เราจะได้ Action ติดมาด้วย เนื่องจากว่าไฟล์ Action ก็เป็นแค่ source file ธรรมดาใน repository เท่านั้นเองครับ

![GitHub Action](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0u6w01kv4ykdhhjp1vn5.png)

เรียกได้ว่าพอสร้างเสร็จก็พร้อมใช้งานทันทีเลยล่ะ เริ่มรันได้เลย เราสามารถเริ่มต้นทำงานได้ทันทีโดยไม่ต้องมานั่งเซ็ตอัพอะไรให้วุ่นวายอีกครับ

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7yuu8phbjskbwjh6upf4.png)
We built an no code database based on svelte-kit & sqlite
Published: 2023-05-26 14:07:24

Hey! I want to share my no-code database. 

* source code: https://github.com/undb-xyz/undb

* demo link: https://demo.undb.xyz?lng=en

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


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


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

Invite you to try Undb
Help! FLUTTER-FTMS
Tags: ftms, flutter, vscode, dart
Published: 2023-05-26 14:05:57

Hello, my friends, can you help me? I would like to know how to display everything that is on the exercise machine's display in the mobile app. I'm working on an app for my college final project, and I've already asked for help on GitHub and Stack Overflow, but nobody was able to assist me. I'm using Flutter as the programming language, and the exercise machine uses Bluetooth and FTMS. I've already created a page to try to achieve this, but only the UUIDs of the machine's characteristics appear. With the example code from the "flutter_ftms" package(https://github.com/Malte2036/flutter_ftms), I can only obtain the supported characteristics of the machine. The issue is that I don't know which UUID corresponds to which characteristic.
how to limit OpenAI API usage and avoid spam messages?
Tags: chatgpt, openai, api, node
Published: 2023-05-26 13:48:29

Hey! I am new to the world of AI and I want to build a Mood tracker web app using MERN and openAI's AI assistant.

So the project is basically around mental health and the AI acts as a virtual therapist who kind of analyzes the mood of the user by asking different questions and helps them.

I want the AI assistant to focus on the conversation around the topic and avoid spamming messages.

Note: I am using a free trial of the API key.

How do I do it? 

Also If you have any suggestions and ideas about this project. Feel free to comment down:)