0

I'm developing a small data-crunching / visualization app in Sinatra, and am split between two options.

The functionality is that you:

  1. Upload a file to the app.
  2. See a nice visualization of its contents.
  3. Maybe start over with a new file.

So my choices are:

  1. Letting both views (upload and results) be managed by the same template, thus creating a single-page app.
  2. Splitting uploads and the visualization between two pages. You upload a file to '/', then are redirected to that file's URL which displays the results.

Which one is better? The advantage of the first is that I can manage it all within the same page, by passing some local vars between the two views.

On the other hand, the second seems like the more RESTful option - because each uploaded file gets its own URL and can be treated as a resource (more fine-grained control).

4

1 回答 1

1

因此,如果您想提供一个 RESTful API 以及 Web 应用程序,最好有两个不同的routes.

如果您打算只拥有一个 Web UI,这取决于您想给予最终用户多少控制权。

这两种方法都没有错。这取决于您可以提供多少轻松。

于 2013-05-27T15:05:24.293 回答