You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uploading files is one of the most important tasks while we're working on a web project. So, in the article, I will show you how I upload files with soki.
Schemas
File Schema
In this section, I will create a function type called upload. And I will put this function type into a child schema called FileSchema. The hello function will have the input and the output like the code below.
Uploading files is one of the most important tasks while we're working on a web project. So, in the article, I will show you how I upload files with soki.
Schemas
File Schema
In this section, I will create a function type called upload. And I will put this function type into a child schema called FileSchema. The hello function will have the input and the output like the code below.
Root Schema
Next, I will put the FileSchema into the RootSchema like this.
On Server
File Resolver
This step, I will implement FileSchema with the Resolvers['file'] type. The upload function will return the name of the file I'm going to upload.
Root Resolver
Next, I will put the FileResolver into the RootResolver like this.
On Client
Finally, I will create a form and an upload function. So I can call the upload function from the FileResolver.
To test the result, please run
yarn dev
and go to http://localhost:3000/upload to see how it works.Demo: https://next-full-stack-git-issue-5.maxvien.vercel.app/upload
Source Code
You can find the source code of this tutorial in this branch: https://github.com/Maxvien/next-full-stack/tree/issue-5
The text was updated successfully, but these errors were encountered: