I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api
Rails.application.routes.draw do
constraints subdomain: "api" do
scope module: "api" do
# official docs: https://graphql-ruby.org/dataloader/sources.html | |
# app/graphql/sources/association.rb | |
class Sources::Association < ::GraphQL::Dataloader::Source | |
def initialize(association_name, scope = nil) | |
@association_name = association_name | |
@scope = scope | |
end | |
def fetch(records) |
I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api
Rails.application.routes.draw do
constraints subdomain: "api" do
scope module: "api" do
require 'rails_helper' | |
RSpec.describe TodosController, :type => :controller do | |
describe "GET #index" do | |
#describe "POST #create" do | |
#describe "GET #show" do | |
#describe "PATCH #update" do (or PUT #update) | |
#describe "DELETE #destroy" do | |
#describe "GET #new" do |
package main | |
import ( | |
"encoding/base64" | |
"net/http" | |
"strings" | |
) | |
type handler func(w http.ResponseWriter, r *http.Request) |