- Notifications
You must be signed in to change notification settings - Fork44
Schema-driven web server framework.
License
teodevgroup/teo
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Teo isschema-driven web server framework. The server side API is native to Rust, Node.js and Python.
- Native toRust,Node.js andPython
- Innovative schema definition inspired byGraphQL andPrisma
- Auto database migration
- SupportsMySQL,PostgreSQL,SQLite andMongoDB
- GeneratedORM types and interfaces
- Generatedquery clients for frontend
- Very efficient and performant
- Data sanitization, transformation and validation
- Builtin usersessions
- Builtinpermission check
- First in last outmiddlewares
- Customroute handlers
- Generated customizableadmin dashboard
- Plays great with AI tools
The fastest way to get started with Teo is by following theQuickstart guide.
Install Node.js edition.
npm install @teodevgroup/teo
Install Python edition.
pip install teo
Install Rust edition.
cargo install teo
To write a server is quite simple with Teo. Create a file namedschema.teo
.Specify which database to connect and which port to listen.
connector { provider: .sqlite, url: "sqlite::memory:"} server { bind: ("0.0.0.0", 5050)} model User { @id @autoIncrement @readonly id: Int @unique @onSet($if($presents, $isEmail)) email: String name: String? @relation(fields: .id, references: .authorId) posts: Post[]} model Post { @id @autoIncrement @readonly id: Int title: String content: String? @default(false) published: Bool @foreignKey authorId: Int @relation(fields: .authorId, references: .id) author: User}
Start the server withteo serve
command. Now you can create, update, delete,read, aggregate and group by. Read ourQuery client guidefor detailed usage.
Declare the handler in the schema.
@map(.get, "/echo/:data", interface: "EchoCaptures")declare nonapi handler echo(): Any
Implement the handler with program code.
import{App,Response,Request}from'@teodevgroup/teo'import{EchoCaptures}from'./entities'constapp=newApp()app.mainNamespace().defineHandler("echo",(request:Request)=>{constcaptures:EchoCaptures=request.captures()returnResponse.string(captures.data,"text/plain")})app.run()
fromasyncioimportrunfromteoimportApp,Response,RequestfromentitiesimportEchoCapturesasyncdefmain():app=App()defecho_handler(request:Request):captures:EchoCaptures=request.captures()returnResponse.string(captures["data"],"text/plain")app.main_namespace.define_handler("echo",echo_handler)awaitapp.run()run(main())
mod entities;use tokio::main;use teo::prelude::{App,Response,Result, path};usecrate::entities::EchoCaptures;#[main]asyncfnmain() ->Result<()>{let app =App::new()?; app.main_namespace().define_handler("echo", |captures:EchoCaptures|asyncmove{Ok::<Response,Error>(Response::string(captures.data(),"text/plain"))}); app.run().await}
We prepared aBeginner tutorial seriesto help you learn and understand Teo.
Welcome to submit issues in this repo.
Read ourContributing guideto set projects up and start contributing.
TEO is under Apache 2.0 license.
About
Schema-driven web server framework.
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors8
Uh oh!
There was an error while loading.Please reload this page.