/Arowana

Building Structuring Sinatra Web Application with Scaffold Code

Primary LanguageRuby

#Structuring Sinatra Web Application Scaffold


Starting from here to create your own web applications, or you want to learn how to wirte a sinatra module based app by example

##Folder structure for Arowana:
folder-chart

##MVC flow chart:
MVC-chart

##Precondition:

  • bundle install
  • check how to start the postgresql service in c9.io
  • set username/pwd as postgres/root if you use my default settings
  • create sinatra_web DB
postgres=# create database "sinatra_web";
  • create "user" table in postgresql DB
CREATE TABLE "user" (
	id serial Primary key NOT NULL,
	username varchar(50) NOT NULL,
	pwd varchar(50) NOT NULL,
	permission varchar(10) NOT NULL
);
  • insert one record into user table
INSERT INTO "user" (username, pwd, permission) VALUES ('admin', 'admin', 'rw');
  • more psql commands, refer to docs

##How to run

On c9.io:

$ rackup config.ru -p $PORT -o $IP  

On your local machine:

$ rackup config.ru  

##Thanks To Sinatra Framework
Structuring Sinatra Applications
Structuring Sinatra Apps
c9.io