-4

I am using rails-api gem for an api project....

I have two or three webpages how do I do it SO that html will make an ajax call and consume JSONS

Where can I keep the html pages and render it..

Abhishek.L
  • 19
  • 5

2 Answers2

0

Rails::API is a subset of a normal Rails application, created for applications that don't require all functionality that a complete Rails application provides. It is a bit more lightweight, and consequently a bit faster than a normal Rails application. The main example for its usage is in API applications only, where you usually don't need the entire Rails middleware stack nor template generation.

You can start adding middleware and subframeworks back to Rails-api - but then your turning your lean and mean racecar into a minivan.

A better solution may be to create a separate rails app which serves the HTML pages and has the full rails package.

max
  • 96,212
  • 14
  • 104
  • 165
  • My requirment is,the datails will be entered in android app and after clicking on submit button,all the data will be saved in the database.I created on api which will pick the json data and save in database.Now the issue is i need to pick the data from the rails-api application database and i need to display that in web browser.As we can not create webpages in api application,how can i move forward.please give me idea how to do it. – Abhishek.L Feb 09 '16 at 06:15
  • 1
    I already have, add the middleware to render views to your rails api app or create a a separate app which serves HTML. – max Feb 09 '16 at 06:26
0

If they're static pages (with static urls), you can put them in /public. It's generally considered bad practice, but it will work.

Tim Scollick
  • 1,242
  • 1
  • 16
  • 17