This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [ | |
{ | |
"name": "arquivo1.txt", | |
"url": "/download/arquivo1.txt" | |
}, | |
{ | |
"name": "arquivo2.txt", | |
"url": "/downlaod/arquivo2.txt" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope "/api", ServerWeb do | |
pipe_through :api | |
get "/files", FileController, :index | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ServerWeb.FileView do | |
use ServerWeb, :view | |
alias ServerWeb.FileView | |
def render("index.json", %{files: files}) do | |
%{data: render_many(files, FileView, "file.json")} | |
end | |
def render("file.json", %{file: file}) do | |
%{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ServerWeb.FileController do | |
use ServerWeb, :controller | |
def index(conn, _params) do | |
{:ok, files} = ServerWeb.PageController.get_files() | |
response = | |
Enum.map( | |
files, | |
&%{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', |