# |
Dec 29th 2018, 19:47 |
challgren |
Your using FOC/crud-json-api? |
# |
Dec 29th 2018, 19:46 |
k4t |
(see my examples above) |
# |
Dec 29th 2018, 19:46 |
k4t |
that code will make urls without .json ext work but json response format will be different from urls with .json ext |
# |
Dec 29th 2018, 19:45 |
k4t |
no, it is not a problem on that stage of project |
# |
Dec 29th 2018, 19:45 |
k4t |
https://gist.github.com/K4T/1a2972e2e93fa1bb542a63a683675a26 |
# |
Dec 29th 2018, 19:43 |
challgren |
You can PM it to me if you dont want to publicly share it |
# |
Dec 29th 2018, 19:42 |
k4t |
sure, w8 |
# |
Dec 29th 2018, 19:42 |
k4t |
so as you can see format is different: /api/v1/users/2.json versus /api/v1/users/2 |
# |
Dec 29th 2018, 19:41 |
k4t |
{ viewVar: "user", user: { id: 2, email: "ketele@gmail.com", password: "heheszek", created_at: "2018-12-29T18:32:08+00:00" }, success: true } |
# |
Dec 29th 2018, 19:40 |
challgren |
Can you post an example controller for me? |
# |
Dec 29th 2018, 19:40 |
k4t |
without .json ext it is: |
# |
Dec 29th 2018, 19:40 |
k4t |
now my problem is that when i use .json url I have response: { success: true, data: { id: 2, email: "xxx@gmail.com", } } |
# |
Dec 29th 2018, 19:39 |
challgren |
Ahhh that damm CRUD plugin, I gotta learn that |
# |
Dec 29th 2018, 19:38 |
k4t |
yes, with CRUD plugin |
# |
Dec 29th 2018, 19:38 |
challgren |
So from what Im understanding you want all your urls to return json? |
# |
Dec 29th 2018, 19:38 |
challgren |
https://book.cakephp.org/3.0/en/views/json-and-xml-views.html#using-data-views-with-the-serialize-key |
# |
Dec 29th 2018, 19:38 |
k4t |
as now urls without .json ext are returning JSON response but in a bit different format then the same urls with ,json ext |
# |
Dec 29th 2018, 19:37 |
challgren |
that are already set |
# |
Dec 29th 2018, 19:37 |
challgren |
your true should be an array of vars |
# |
Dec 29th 2018, 19:37 |
k4t |
and it only half solved my problem |
# |
Dec 29th 2018, 19:37 |
k4t |
no, but I did: $this->set(‘_serialize’, true) |
# |
Dec 29th 2018, 19:36 |
challgren |
Are you $this->set(‘_serialize’, [])? |
# |
Dec 29th 2018, 19:35 |
k4t |
of course @challgren |
# |
Dec 29th 2018, 18:51 |
challgren |
@k4t https://book.cakephp.org/3.0/en/views/json-and-xml-views.html#enabling-data-views-in-your-application |
# |
Dec 29th 2018, 18:49 |
challgren |
@k4t are you loading RequestHandler? |
# |
Dec 29th 2018, 18:28 |
NickBusey |
Users won’t know about cake or react. They just login to the site, not sure what your concern is |
# |
Dec 29th 2018, 18:26 |
NickBusey |
Not really worried about anyone else, just making this for fun |
# |
Dec 29th 2018, 18:26 |
NickBusey |
My target user base is myself. |
# |
Dec 29th 2018, 18:26 |
NickBusey |
Haha, no they don’t. They just use the interface |
# |
Dec 29th 2018, 18:26 |
challgren |
They’ll get frustrated and use something else |
# |
Dec 29th 2018, 18:26 |
challgren |
Your target user base is home brewers not developers |
# |
Dec 29th 2018, 18:23 |
challgren |
But nick think of it from a new user perspective they are going to have to learn cake and react just to use your app |
# |
Dec 29th 2018, 18:22 |
itmpls |
lol |
# |
Dec 29th 2018, 18:21 |
k4t |
and well... google is not the only search engine... I know I know... |
# |
Dec 29th 2018, 18:21 |
NickBusey |
Also it will be targeting self Hosters, so no bandwidth concerns. Also the core cake app remains if they prefer |
# |
Dec 29th 2018, 18:21 |
NickBusey |
For my app seo is definitely not a concern |
# |
Dec 29th 2018, 18:20 |
challgren |
Plus why force your users that maybe on limited BW to download 5mbs when they only need like 700kb |
# |
Dec 29th 2018, 18:20 |
challgren |
Hehe yep! But I’m also a SEO guy so Im not a fan of SPAs cause of that. |
# |
Dec 29th 2018, 18:19 |
itmpls |
@challgren would like to launch that rocket launcher at SPAs :P |
# |
Dec 29th 2018, 18:19 |
challgren |
And also look at page load time. SPA causes huge load times from my experiences. I’ve seen SPA apps taking as much as 5mbs just to load |
# |
Dec 29th 2018, 18:18 |
itmpls |
such as? |