Elixir Phoenix
Learn how to configure an Elixir Phoenix App for use with Filebase.
What is Elixir Phoenix?
1. Create a new Elixir project with the command:
2. Next, create a new database with the command:
3. Then, add the Ex.Aws.S3 package to your Elixir list of dependencies in your project’s mix.esc file:
mix.esc file:4. Install these dependencies with the command:
5. Configure the Ex.Aws.S3 package to use your FIlebase instance with the following configuration in your project’s config/config.exs file:
config/config.exs file:6. Create a .env file with the following environment variables:
.env file with the following environment variables:7. Then, source this environmental variable file with the command:
8. Next, in the lib/file_upload_app_web/router.ex file, add the following code:
lib/file_upload_app_web/router.ex file, add the following code:9. Create a new migration with the command:
10. This command will create a new file located at priv/repo/migrations/add_uploads.exs. Open this file and insert the following code:
priv/repo/migrations/add_uploads.exs. Open this file and insert the following code:11. Then apply the changes to the Elixir project with the command:
12. Within the file_upload_app_web folder, create a new folder called models, with a new file inside called upload.ex. Insert the following code:
file_upload_app_web folder, create a new folder called models, with a new file inside called upload.ex. Insert the following code:13. Next, within the templates folder, create a new folder called upload, then within that folder create a new file called new.html.eex. Inside this new file, insert the following:
templates folder, create a new folder called upload, then within that folder create a new file called new.html.eex. Inside this new file, insert the following:14. Lastly, create a new upload_controller.ex file in the controllers folder. Add the following code to the file:
upload_controller.ex file in the controllers folder. Add the following code to the file:15. Now it’s time to start the server. Use the command:
16. The server will start on localhost:4000. Open this in a web browser, then go to localhost:4000/uploads/new to upload a file.
localhost:4000. Open this in a web browser, then go to localhost:4000/uploads/new to upload a file.Last updated