What is an web backend
A backend is the piece of software that deals with the business logic for interacting with the application’s data. This could be tweets, account records, facebook posts, and any other sort of data that you could think of that a user would want to interact with.
In a later tutorial we will go over frontend development to help shape what the user sees.
What are we going to build?
We are going to build a simple store inventory system. That way a grocery manager/clerk can keep track of what items are in stock. This tutorial will be separated into different parts. In this one we are going to just set up rails and generate some basic code to start.
Make sure that you have Ruby installed. Once you do we are going to run this command in the terminal
gem install rails
This installs the latest version of rails that we will be used for developing our store inventory software.
Alright it is time to create our application.
rails new inventory-system
This creates our new application in a folder called
inventory-system and then we move into that folder and install our libs with the
bundle install command.
From this point on, when I refer to
/, I mean the path to the
inventory-system project folder.
Launching the application
You can launch the application with
Then navigate your web browser to
You should see something like this..
Generating helper code
We are going to generate some code just to save some time.
Generating the data model
A model is software layer that simplifies the process of saving and reading data from our database.
So for our
items model. run
rails generate model item name:string description:text price:decimal
This generates a model that has a name, description, and a price field. This will be important later on when we are saving or viewing item data. We then run a migration with the second command so the database is changed in response to our model code we generated.
Generating the controller
The controller is the code that is the real meat of the application. This is where all the business logic goes.
To generate our controller run
rails generate Inventory
This generates a controller (ruby file) that will deal with all the business logic for managing our inventory. Our inventory will just be a collection of
This will generate a file called
in the file you’ll see
create a function called
def index end
and then go into
and add the code as seen from the
new code comment
Rails.application.routes.draw do # New code root 'inventory#index' end
then create the file starting from root
inside it write
Now if we visit
localhost:3000, we should see this simple web page with the text, Hello There
That’s it for this tutorial. In the next one we are going to actually load some items into the database and render them to the client.
There will also be a separate tutorial on install bootstrap for this project.
You can get the source code for this project on Github
So one day, I was watching Anime. I do this on a frequent basis. With that being the case, I realized at some point that there was so much anime that I was losing track of. I looked at the current implementation out there… mainly MyAnimeList, but I thought I should build something a bit more extendable. There were a couple features and aesthetics that I wanted to modify. Not only that, I also have a set of favorate characters(A.K.A Waifus) that I thought would be cool to add in too. There is also a collection for this called MyWaifuList
The stack as of right now is just Angular 6.0 with TypeScript and Web Browser Storage. As I further develop the app. I’ll probably off load some of the logic onto a backend server of some sort.
- Profile Page (WIP)
- Anime Search
- Waifu showcase
- Anime/Entertainment collection Page
- In Progress Features
Well that’s all I have to say about Animku (WIP). If you’d like to learn more or take a look. You can check the source code out at Github
So with the wonderful amount of time I have allocated during the summer. I get to do some things that I would not normally do on a school day.
Note… It’s like one in the morning so…
Hmm indeed. I have been coding something to do with Anime and some other cutesy things. Though anime is a niche, I plan on expanding it onto other stuff. Then I can just integrate with like 5 apis for ex (YouTube, Netflix, SoundCloud, etc…….)
What did I code today?
Looky here -> Github Link
I’ll have a prototype out later this week. (I think)
What will happen tomorrow
Probably more coding. I’ll also start working on my more serious app. More detail on that tomorrow
See ya next time.