官术网_书友最值得收藏!

Analyzing folder structure of a Rails application

Let's navigate to the TODO folder to check how our application's folder structure looks like:

Analyzing folder structure of a Rails application

Let me explain to you some of the important folders here:

  • The first one is the app folder, which we will be focusing on the most throughout this book. All our application's content will be present inside this folder.
  • The assets folder inside the app folder is the location to store all the static files like JavaScript, CSS, and Images. You can take a sneak peek inside them to look at the various files.
  • The controllers folder handles various requests and responses of the browser.
  • The helpers folder contains various helper methods both for the views and controllers.
  • The next folder mailers, contains all the necessary files to send an e-mail.
  • The models folder contains files that interact with the database.
  • Finally, we have the views folder, which contains all the .erb files that will be complied to HTML files.

So, let's start the Rails server and check out our application on the browser:

  1. Navigate to the TODO folder in the terminal and then type the following command to start a server:
    rails server
    

    You can also use the following command:

    rails s
    
  2. You will see that the server is deployed under the port 3000. So, type the following URL to view the application:

    http://localhost:3000.

    You can also use the following URL: http://0.0.0.0:3000.

  3. If your application is properly set up, you should see the default page of Rails in the browser:
    Analyzing folder structure of a Rails application
主站蜘蛛池模板: 西乡县| 盐源县| 乐业县| 绵竹市| 香港| 乐昌市| 涞源县| 明光市| 荣成市| 建湖县| 泉州市| 宁陵县| 大田县| 明溪县| 通辽市| 玛纳斯县| 汉沽区| 呼伦贝尔市| 铁岭市| 宽城| 盐城市| 扶风县| 鄢陵县| 寿阳县| 遂溪县| 香河县| 剑阁县| 乌恰县| 荥阳市| 财经| 松滋市| 犍为县| 思茅市| 山阴县| 利川市| 页游| 霍林郭勒市| 界首市| 垦利县| 汉源县| 浪卡子县|