Build a JSON API with Rails and JSONAPI Resources

rails json api code
Standard

Introduction

In this tutorial, we will discuss how to quickly build a JSON API that is JSONAPI spec compliant using Ruby on Rails and jsonapi-resources.

This tutorial assumes that you already have Ruby and Ruby on Rails installed in your computer and you already have a basic understanding how APIs work. This tutorial uses Ruby 2.1.2 and Rails 4.2.0.

JSONAPI spec is a specification for building APIs in JSON. The spec covers how a client should request that resources be fetched or modified, and how a server should respond to those requests.

Continue reading

Build a Net Income Calculator App with Ruby

ruby income calculator
Standard

Share this tutorial w/ your followers on Twitter. Click this link to tweet this tutorial: https://goo.gl/visSgs

This tutorial is for beginners who want to learn how to build applications in Ruby programming language.

What will we build?

We will build a net income calculator for freelancers in an imaginary company that serves as a middleman between a freelancer and an employer. To be able to focus on Ruby, we won’t build a web based application so you won’t have to use HTML. What we will build is a very simple command line application.

Continue reading

Build a Net Income Calculator App with Python

python logo
Standard

Share this tutorial w/ your followers on Twitter. Click this link to tweet this tutorial: https://goo.gl/o7nTMZ

This tutorial is for beginners who want to learn how to build applications in Python programming language.

Important Note

If you’re using Python 3, you should use:

  • input() instead of raw_input()
  • print() instead of print. Example: instead of print “hello”, you should use print(“hello”)

What will we build?

We will build a net income calculator for freelancers in an imaginary company that serves as a middleman between a freelancer and an employer. To be able to focus on Python, we won’t build a web based application so you won’t have to use HTML. What we will build is a very simple command line application.

Continue reading

Part 2 of Build a CRUD Web App with Flask Python Framework

flask python framework logo
Standard

Haven’t yet read the 1st part of the tutorial? Visit: http://tutorialsfordevs.com/tutorials/build-a-crud-web-app-with-flask-python-framework/

Looking for a remote / home based job? Visit http://digitalnomadgigs.com/


In the first part of the tutorial, we defined a Note model:

class Note(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(80))
    body = db.Column(db.Text)
    def __init__(self, title, body):
        self.title = title
        self.body = body

Jaapz told me that we don’t have to use a custom __init__ method when creating SQLAlchemy models: https://www.reddit.com/r/flask/comments/4bgisp/how_to_build_a_crud_application_using_flask/d18ygml

Continue reading

Build a CRUD Web App with Flask Python Framework

flask python framework logo
Standard

Share this tutorial w/ your followers on Twitter. Click this link to tweet this tutorial: https://goo.gl/MtIA1L

The application that we will build is a very simple database driven note taking application. This tutorial is for beginners who want to learn how to use Flask for developing websites or web applications.

This tutorial assumes that you already installed Python and SQlite. If Python and SQlite is not yet installed in your computer, install them first. If the Python version that you installed is 2.5 and up, then you don’t need to install SQlite since Python 2.5 and up already comes with SQlite.

Python: https://www.python.org/

SQlite: https://www.sqlite.org/download.html

Things that we will cover in this tutorial:

  • Using templates
  • Saving a record in the database
  • Fetching a record in the database
  • Updating a record in the database
  • Deleting a record in the database

App requirements:

  • The user should be able to create a note (a note can have a title and a body)
  • The user should be able to view a list of notes
  • The user should be able to edit a note
  • The user should be able to delete a note

Continue reading