Code Monkey home page Code Monkey logo

Comments (8)

wyuenho avatar wyuenho commented on June 12, 2024

What is your solution to this Windows file system idiocy?

from backbone-pageable.

bryanbuchs avatar bryanbuchs commented on June 12, 2024

Well, it looks to me like you're trying to simulate calls to a server-based API using flat files? I would guess the purpose of that would be so the demo can be run without any server backend, correct?

My solution would be to pump out a quick PHP script to serve up the files. So the naming scheme for the JSON would be territories-1.json, territories-2.json, etc. And the PHP script would look at the page parameter and return the corresponding JSON file.

https://gist.github.com/bryanbuchs/5006818

I say PHP because (a) that's what I'm familiar with and (b) it's relatively ubiquitous.

from backbone-pageable.

wyuenho avatar wyuenho commented on June 12, 2024

Any solution that just uses the file system? I don't want to fire up a web server.

from backbone-pageable.

monzou avatar monzou commented on June 12, 2024

Hi, @wyuenho

I got a same problem on Windows for installing backbone-pageable via bower.
I know you don't want to change for this Windows file system idiocy (I would think so too if I were you), but this is necessary for supporting Windows (+ bower) users.

Could you change the filenames for supporting Windows (or PR) ?
(ex. territories.json_page=10&per_page=15)

from backbone-pageable.

wyuenho avatar wyuenho commented on June 12, 2024

Not that I don't want to change, but I don't have a windows machine to test this with. Pull requests welcome. You should be able to fix this without requiring a server. All you need is to encode/decode the URI components.

from backbone-pageable.

monzou avatar monzou commented on June 12, 2024

encode/decode URI component ?

A simple solution for example is to change emulated API @ server.html to not use query parameters like json/territories/1/data.json/15 or json/territories.json_page=1&per_page=15.
Of course this works on Windows, but I guess you don't want to do ?

from backbone-pageable.

bryanbuchs avatar bryanbuchs commented on June 12, 2024

@wyuenho: " All you need is to encode/decode the URI components."

No, that's not the issue. The file system won't allow a filename that uses reserved characters. Using reserved characters in a filename is generally considered bad practice for cross-platform development. I understand what you're trying to do -- demonstrate the app without the need for a server -- but you're doing it at the expense of a very large chunk of your audience.

If you are dead set on a demo without a server, why not use bootstrap the data and use the "client" mode?

from backbone-pageable.

bryanbuchs avatar bryanbuchs commented on June 12, 2024

Pull request sent with fix for server mode.

from backbone-pageable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.