# createProject()

## Syntax

```javascript
createProject(data: NewProject, token: string)
```

This method is used when you want to create a new project.

## Parameters

<table><thead><tr><th width="104">Name</th><th width="121">Type</th><th width="108">Required</th><th>Description</th></tr></thead><tbody><tr><td>data</td><td>NewProject</td><td>Yes</td><td>Object contains project information.</td></tr><tr><td>token</td><td>string</td><td>Yes</td><td>The authentication token response from Eueno API when login. After login, this token was saved in local storage with the name “eueno-token".</td></tr></tbody></table>

The interface of NewProject looks as below

```javascript
interface NewProject {
 name: string; //Project name
}
```

## Returns

Promise returns a JSON - project info:

* &#x20;  totalFile: The number of files/folders in the project
* &#x20;  totalSize: The project size (bytes)
* &#x20;  id: The project id
* &#x20;  name: The project name
* &#x20;  ownerAddress: The address of the Owallet account which created the project
* &#x20;  updatedAt: The last date time update project
* &#x20;  createdAt: The date-time create the project

## Example

```javascript
import {createProject} from "@eueno/lib-browser";

const onSubmit = async (data) => {
   const response = await createProject(data, token);
   if (response?.status == 200) {
     console.log(response);
     toast.success("Project created!");
   } else {
     toast.error(response || "An error occurred, please try again later");
   }
 };
```

Response of example:

```javascript
    "data": {
        "totalFile": "0",
        "totalSize": "0",
        "id": 1,
        "name": "ProjectName",
        "ownerAddress": "0x…",
        "updatedAt": "2023-03-08T10:43:53.677Z",
        "createdAt": "2023-03-08T10:43:53.677Z"
    }
```
