The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

Slim in a single page application

daedalus's Avatar

daedalus

16 Jul, 2012 04:42 AM

Hello, today I used Slim to provide my applications a RESTful API to a MySQL database. It was straight-forward and I really enjoy using Slim so far because it is so concise; it really is perfect for most of the back-end work I have to do.

Now I am moving on to the application and have decided to implement that using Slim as well. Since the application is single-page anyway, I really only need to write a front controller that hands the route off to the template so javascript can consume it.

Right now I am staring at some optional parameters and passing those to the template. It seems like there is probably a much better way, but I wanted to ask around anyway since this is my first day using Slim.

Ideally, every request would be directed to "/" any part of the url after that could be serialized and passed. But I read that wildcard routes wont be available until release 1.7

So any ideas? Or at least a direction I can throw myself in? Thanks!

  1. Support Staff 1 Posted by Josh Lockhart on 16 Jul, 2012 11:30 AM

    Josh Lockhart's Avatar

    Wild card routes should be released by Wednesday. I'm waiting on one last pull request change before I can take 1.6.5 live. I've recently revised the project Road Map. Worth a look.

    If you need a solution today, there are several workarounds. See this for a temporary solution:

    http://nesbot.com/2012/7/3/slim-wildcard-routes-improved

    Josh

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac