001
This commit is contained in:
8
.editorconfig
Normal file
8
.editorconfig
Normal file
@@ -0,0 +1,8 @@
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.v]
|
||||
indent_style = tab
|
8
.gitattributes
vendored
Normal file
8
.gitattributes
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
* text=auto eol=lf
|
||||
*.bat eol=crlf
|
||||
|
||||
*.v linguist-language=V
|
||||
*.vv linguist-language=V
|
||||
*.vsh linguist-language=V
|
||||
v.mod linguist-language=V
|
||||
.vdocignore linguist-language=ignore
|
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Binaries for programs and plugins
|
||||
main
|
||||
todo2
|
||||
*.exe
|
||||
*.exe~
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Ignore binary output folders
|
||||
bin/
|
||||
|
||||
# Ignore common editor/system specific metadata
|
||||
.DS_Store
|
||||
.idea/
|
||||
.vscode/
|
||||
*.iml
|
||||
|
||||
# ENV
|
||||
.env
|
||||
|
||||
# vweb and database
|
||||
*.db
|
||||
*.js
|
23
src/main.v
Normal file
23
src/main.v
Normal file
@@ -0,0 +1,23 @@
|
||||
module main
|
||||
|
||||
import veb
|
||||
|
||||
pub struct Context {
|
||||
veb.Context
|
||||
}
|
||||
|
||||
pub struct App {
|
||||
veb.StaticHandler
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mut app := &App{}
|
||||
|
||||
app.handle_static('static', false)!
|
||||
|
||||
veb.run[App, Context](mut app, 8080)
|
||||
}
|
||||
|
||||
pub fn (app &App) index(mut ctx Context) veb.Result {
|
||||
return ctx.text('Namaste India!!')
|
||||
}
|
10
src/todo_entities.v
Normal file
10
src/todo_entities.v
Normal file
@@ -0,0 +1,10 @@
|
||||
module main
|
||||
|
||||
@[table: 'todo']
|
||||
pub struct Todo {
|
||||
mut:
|
||||
id int @[primary; sql: serial]
|
||||
user_id int
|
||||
todo string @[nonull; sql_type: 'TEXT']
|
||||
status string @[nonull; sql_type: 'TEXT']
|
||||
}
|
9
src/user_entities.v
Normal file
9
src/user_entities.v
Normal file
@@ -0,0 +1,9 @@
|
||||
module main
|
||||
|
||||
@[table: 'users']
|
||||
pub struct User {
|
||||
mut:
|
||||
id int @[primary; sql: serial]
|
||||
username string @[nonull; sql_type: 'TEXT'; unique]
|
||||
todos []Todo @[fkey: 'user_id']
|
||||
}
|
Reference in New Issue
Block a user