DEV Community

loading...
Cover image for Typetron Beta is here: typetron.org
Typetron

Typetron Beta is here: typetron.org

ionellupu profile image Ionel lupu ・2 min read

Since my last post about Typetron there have been some crazy months but it is finally here.

Typetron BETA is here!

Typetron is a Node.js web framework used for creating backend services. I demonstrate this in two of the available tutorials:

How does it look like in code?

Controlers

import { Controller, Delete, Get, Put, Post } from '@Typetron/Router'
import { Article } from 'App/Entities/Article'
import { ArticleForm } from 'App/Forms/ArticleForm'

@Controller('articles')
export class ArticleController {
    @Get()
    all() {
        return Article.get()
    }

    @Post()
    add(form: ArticleForm) {
        return Article.create(form)
    }

    @Put(':Article')
    update(article: Article, form: ArticleForm) {
        return article.fill(form).save()
    }

    @Delete(':Article')
    async delete(article: Article) {
        await article.delete()
    }
}
Enter fullscreen mode Exit fullscreen mode

Entities

import { Column, Entity, ID, HasMany, Relation } from '@Typetron/Database'
import { Comment } from 'App/Entities/Comment'

export class Article extends Entity {
    @Column()
    id: ID

    @Column()
    title: string

    @Column()
    content: string

    @Column()
    createdAt: Date

    @Column()
    updatedAt: Date

    @Relation(() => Comment, 'article')
    comments: HasMany<Comment>
}
Enter fullscreen mode Exit fullscreen mode

If you don't know anything about Javascript or Typetron, you can find some great FREE courses here that I recommend you to watch

It would be great to see your feedback and what features you would like to see in a framework like this. Take the tutorials and see what's missing 😄.

Check the website typetron.org
Twitter at @Typetron_
My Twitter @ionellupu_
Come and leave a question on Reddit
Join the Facebook group
Let's talk on Slack
Linkedin - Typetron

Discussion (0)

pic
Editor guide