initial commit

This commit is contained in:
Sam Dodrill 2015-01-05 13:41:19 -08:00
commit 6515955a14
10 changed files with 189 additions and 0 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
app.lua
logs
*_temp
nginx.conf.compiled

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.lua
logs
*_temp
nginx.conf.compiled

3
Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM xena/lapis

28
app.moon Normal file
View File

@ -0,0 +1,28 @@
lapis = require "lapis"
db = require "lapis.db"
csrf = require "lapis.csrf"
import respond_to from require "lapis.application"
import Model from require "lapis.db.model"
class User extends Model
@primary_key: "login"
class App extends lapis.Application
"/": =>
render: "index"
[form: "/form"]: respond_to {
GET: =>
assert @
csrf_token = csrf.generate_token @
@html =>
form method: "POST", action: "/form", ->
input type: "hidden", name: "csrf_token", value: csrf_token
input type: "submit"
POST: =>
csrf.assert_token @
"The form is valid!"
}

3
app.rockspec Normal file
View File

@ -0,0 +1,3 @@
dependencies = {
"lapis"
}

14
config.moon Normal file
View File

@ -0,0 +1,14 @@
config = require "lapis.config"
config "development", ->
port 8080
postgres ->
backend "pgmoon"
host "127.0.0.1"
user "lapis"
password "lapis"
database "panel"
config "production", ->
port 5000

16
migrations.moon Normal file
View File

@ -0,0 +1,16 @@
import add_column, create_table, types from require "lapis.db.schema"
{
[1]: =>
create_table "users", {
{ "id", types.serial }
{ "email", types.text }
{ "name", types.text }
{ "password", types.text }
"PRIMARY KEY (id)"
}
[2]: =>
add_column "users", "admin", types.boolean
}

79
mime.types Normal file
View File

@ -0,0 +1,79 @@
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
image/webp webp;
application/java-archive jar war ear;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.ms-excel xls;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream eot;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}

31
nginx.conf Normal file
View File

@ -0,0 +1,31 @@
worker_processes ${{NUM_WORKERS}};
error_log stderr notice;
daemon off;
events {
worker_connections 1024;
}
http {
include mime.types;
server {
listen ${{PORT}};
lua_code_cache ${{CODE_CACHE}};
location / {
default_type text/html;
content_by_lua '
require("lapis").serve("app")
';
}
location /static/ {
alias static/;
}
location /favicon.ico {
alias static/favicon.ico;
}
}
}

7
views/index.moon Normal file
View File

@ -0,0 +1,7 @@
import Widget from require "lapis.html"
class Index extends Widget
content: =>
h1 class: "header", "Hello"
div class: "body", ->
text "Welcome to my site!"