Giter Club home page Giter Club logo

superheros-code-challenge's Introduction

README

To begin, we’ll use the rails new command to generate the backend code:

rails new name-api --api --minimal

cd name-api The “minimal” setting disables a number of Rails capabilities that we won’t be using in our API. to be able to see the data in the front end, we have to tell Rails to use GET requests. On our Rails server, we’ll need to establish a route and controller action to make that request function. We’ll also need a model to connect with the database, as well as a migration to create the database table that corresponds to the model. Rails provide developers the necessary tools with the code “rails g resource”.

Creating resources

The command

rails g resource Example name:string year:integer

Creates a migration to create an example table with the characteristics given Creates a model file Creates a controller file In order to fill the migration tables with example data. You can use the faker gem and create some data in the “db/seeds.rb” file. To set up the table with data, we run:

rails db:migrate db:seed This will create the new migration table with the seed data, as well as the schema for the migration. If your application only needs specific CRUD action, we can go ahead and edit our “routes.rb” file.

superheros-code-challenge

superheros-code-challenge's People

Watchers

Janet Ngei. avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.