![]() rails new cow_say -api -skip-active-recordĪfter this command is done, we’ll need to add two more gems to our Gemfile: In our case, we’ll generate a new API project, and also skip ActiveRecord, since we won’t be needing to store anything in a database. This can be further customized depending on your needs. Fortunately, Rails’ application generator offers an option to create a more “lean” version of a Rails app, where only the necessary modules for an API are installed. We won’t be rendering HTML views, for example. ![]() Since we’re going to be building an API, we don’t exactly need everything Rails offers. I personally prefer Visual Studio Code, but feel free to use the editor you’re most comfortable with. Other than that, you’ll need your favorite code editor. Installing Rails is also pretty simple: you can use their official installation guide. To install Ruby, refer to the official website for instructions. Both are relatively easy to install, but the procedure depends on the platform you’re on. What we will needįor this tutorial, you will need Ruby (preferably 2.6) and Ruby on Rails. We’ll later deploy this API to Heroku and publish it to RapidAPI so it’s easier for other developers to find it. Users of the API will be able to send a text and customize it using different parameters accepted by the Cowsay program. In this article, we’ll be building an API as an interface to Cowsay. If you’re planning on building an app, adding an API should definitely be in your roadmap. There are different types of APIs, but most boil down to RESTful, JSON APIs. ![]() ![]() Shorthand for Application Programming Interface, it provides developers programmatic access to the service. Every major online service nowadays offers an API.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |