Yii Framework Forum: REST only application - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

REST only application not based on advanced app - has anyone done this?

#1 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,694
  • Joined: 10-October 10
  • Location:Denmark

Posted 14 October 2017 - 09:06 AM

I want to create the frontend in Elm, and my Yii application should be just backend, no views, not even an admin section.

I've seen lots of examples of using the advanced application template for this, but I don't want the second application.

So, my application is only going to be made of console / REST - using modules for versioning.

Any exisiting Yii projects I could take a look at / learn from ?
"Less noise - more signal"
0

#2 User is offline   alrazi 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,404
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 14 October 2017 - 09:38 AM

I don't have an example but you could have your elm source as part of your php application and use elm build tools to compile elm to whatever directory you like.
2

#3 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,694
  • Joined: 10-October 10
  • Location:Denmark

Posted 14 October 2017 - 10:54 AM

I think I can handle Elm. :)

It's the Yii backend that I am more concerned about.

I guess I just have to dive right into it, then. Posted Image

What I want is a REST-only Yii application - with no routing/views/backends ... only a REST API endpoint.
"Less noise - more signal"
0

#4 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,694
  • Joined: 10-October 10
  • Location:Denmark

Posted 14 October 2017 - 10:56 AM

The closest I've found is this : https://github.com/g...bjeka/yii2-rest

It is, unfortunately, based on the advanced app template.

Also, this article is basing it on the adv templ : https://code.tutsplu...-api--cms-27682


I don't want to couple the frontend with the backend, because that will defeat the purpose: the ability to create different frontends, JS, JS-free and desktop applications, even terminal apps (ncurses!).

Anyone has experience with building a REST only Yii application?

I would be interested in hearing your experiences, pros / cons and gotchas.
"Less noise - more signal"
0

#5 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,694
  • Joined: 10-October 10
  • Location:Denmark

Posted 14 October 2017 - 11:22 AM

I am going to be using Cebe's assetfree-yii2 instead of requiring Yii2 directly because my REST app doesn't need any assets.
"Less noise - more signal"
0

#6 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,694
  • Joined: 10-October 10
  • Location:Denmark

Posted 16 October 2017 - 01:48 AM

I found 2 interesting Yii2 REST application templates that could be modified to suit my requirements:

https://github.com/i...2-rest-template

https://github.com/e...ve/yii2-app-api


I will probably create my own application template, and will of course post a link to it here once it's done.
"Less noise - more signal"
1

#7 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,184
  • Joined: 17-January 09
  • Location:Russia

Posted 16 October 2017 - 02:48 AM

Would be cool.
Yii 2.0 Development Cookbook

Enjoying Yii? Star us at github

Support me so I can work more on Yii: https://www.patreon.com/samdark
0

#8 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,694
  • Joined: 10-October 10
  • Location:Denmark

Posted 17 October 2017 - 05:37 PM

I am working on it - here is what I've got so far:

https://packagist.or...yii2-rest-alone

Complete without a frontend, or even assets, featuring Codeception API tests and simple query param auth.

Need to write a bit of documentation :)


I used https://github.com/p...ii2-minimal-api as a starting point.

I consider this application template feature complete for the time being - application specific features like models, rate limiting and more advanced auth is not something that I feel belong in a general purpose application template.

Comments and pull requests would always be appreciated. :)
"Less noise - more signal"
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users