Up to 9000

  • FTB will be shutting down this forum by the end of July. To participate in our community discussions, please join our Discord! https://ftb.team/discord

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
742 that moment when the text "model got loaded" makes you way too happy.
Then again, I am pretty much done with transforming lapis into an mvc framework in the style that I like.
Just need to expand the route logic so it can be possible to have your application respond to stuff like
/users/{:id} =function() end

as right now, having a route like that would mean the user had to write www.somewebsite.com/user/{:id} which doesn't allow what I want it to be able to do (which is have the user write www.somewebsite.com/user/4 as url and have my program know it needs to run the thing that is needed for /users/{:id} and have in this case the 4 available for the function that handles that url. )

I do think I have already a way "nice" way to do this though
Lets say the url is users/update/4
Step1 look if there is a route set for "users/update/4
Step 2 if there isn't, remove the last bits of the string until a "/" is found.
step 3 look if there is an route set which is the new string with "/*" after it
step4 repeat 2 until a route is found or until there is nothing left to remove
step5 if no string is left, run 404 code, else run code that belongs to the route it found.

This will make it so it will look for the following routes in this order
/users/update/4
/users/update/*
/users/*
/*
{404}

Not perfect as you can't have 2 variables in the url but it is close enough I would say :)