This exercise involves creating API endpoints to create a text file in a particular folder and to retrieve all the text files in that particular folder.
- Created an
Express
server - Created two API endpoints using
writeFileSync
andreaddirSync
. writeFileSync
to write data to a file.readdirSync
to read the contents of the directory and it returns an array of names of files and directories inside the particular folder.
- To write a file - https://nodejsfilesystem-jq09.onrender.com/write-file
- To list the files in a directory - https://nodejsfilesystem-jq09.onrender.com/list-files