This commit is contained in:
Aritra Banik
2025-03-04 01:42:11 +05:30
commit 52afd35ba5
7 changed files with 89 additions and 0 deletions

8
.editorconfig Normal file
View 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
View 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
View 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
View 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
View 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
View 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']
}

7
v.mod Normal file
View File

@@ -0,0 +1,7 @@
Module {
name: 'todo2'
description: ''
version: '0.0.0'
license: 'MIT'
dependencies: []
}