mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Blog API example (#377)
This commit is contained in:
5
examples/apps/blog/schema/Gemfile
Normal file
5
examples/apps/blog/schema/Gemfile
Normal file
@@ -0,0 +1,5 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'json', '> 2'
|
||||
gem 'sequel'
|
||||
gem 'mysql2'
|
||||
10
examples/apps/blog/schema/create.rb
Normal file
10
examples/apps/blog/schema/create.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
require "sequel"
|
||||
|
||||
DB = Sequel.connect("mysql2://docker.for.mac.localhost/blog?user=#{ENV['DB_USER']}&password=#{ENV['DB_PASS']}")
|
||||
|
||||
# create a posts table
|
||||
DB.create_table :posts do
|
||||
primary_key :id
|
||||
String :title
|
||||
String :body
|
||||
end
|
||||
5
examples/apps/blog/schema/func.yaml
Normal file
5
examples/apps/blog/schema/func.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
version: 0.0.2
|
||||
runtime: ruby
|
||||
entrypoint: ruby create.rb
|
||||
build_image: treeder/ruby-mysql
|
||||
run_image: treeder/ruby-mysql
|
||||
Reference in New Issue
Block a user