@typetron/framework 0.5.8 → 0.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE.md +21 -0
  2. package/Readme.md +123 -0
  3. package/package.json +2 -2
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [2019] [Ionel-Cristian Lupu]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/Readme.md ADDED
@@ -0,0 +1,123 @@
1
+ # Typetron
2
+ > **Note:** This project is a prototype in heavy development and not ready for production.
3
+
4
+ **[Typetron](https://typetron.org)** is a **modern web framework** built for Node.js, written in **Typescript**, that
5
+ allows you to build fully featured web applications.
6
+ Typetron is best suited for small sized to enterprise level apps.
7
+ Most of the core packages it uses were built from scratch in order to preserve the performance of the framework.
8
+
9
+ _(check [this tutorial](https://typetron.org/tutorials/blog) on how to get started with Typetron)_
10
+
11
+ ### Prerequisites
12
+ - [NodeJs >=12 LTS](https://nodejs.org)
13
+
14
+ #### Features
15
+ Typetron aims to have all the features necessary for building any web app without the need for you
16
+ to search the internet for a package to use. Almost all the packages it has were built from scratch and are
17
+ available in the framework.
18
+ This was done to ensure that all the features you are using benefit from the latest language features.
19
+ Also, every package can be tuned for performance or updated in no time if needed.
20
+
21
+ ##### Features List
22
+
23
+ [typetron.org](https://typetron.org/docs/)
24
+
25
+ ##### Performance
26
+ Being built with packages created from scratch using the latest features of the language, Typetron comes with
27
+ excellent performance out of the box compared to other available frameworks.
28
+
29
+ ##### Developer experience
30
+ Typetron's source code is built around developer's expectations: it is modern, clean and beautiful.
31
+ Also, the tools Typetron is providing are everything a developer needs to build his next awesome project.
32
+
33
+ ##### Code sharing
34
+ A few years ago we wrote websites. Nowadays we write web applications. The web evolved alongside the tools we are
35
+ using. A typical web application is composed of at least two parts: a backend app and a frontend app.
36
+ This separation led to two different camps that have a very distinct line between them. Typetron provides tools to make
37
+ these two camps work together.
38
+
39
+ #### Source code examples
40
+
41
+ ##### Entities
42
+ ```ts
43
+ export class User extends Entity {
44
+
45
+ @PrimaryColumn()
46
+ id: number;
47
+
48
+ @Column()
49
+ email: string;
50
+
51
+ @Column()
52
+ name: string;
53
+
54
+ @Relation(() => Post, 'author')
55
+ posts: HasMany<Post> = [];
56
+
57
+ @Relation(() => Group, 'users')
58
+ group: BelongsTo<Group>;
59
+ }
60
+ ```
61
+ ##### Forms
62
+ ```ts
63
+ export class UserForm extends Form {
64
+ @Field()
65
+ @Rules(
66
+ Required,
67
+ )
68
+ email: string;
69
+
70
+ @Field()
71
+ @Rules(
72
+ Required,
73
+ MinLength(5),
74
+ )
75
+ name: string;
76
+
77
+ @Field()
78
+ dateOfBirth: Date;
79
+ }
80
+ ```
81
+
82
+ ##### Controllers
83
+
84
+ ```ts
85
+ @Controller('users')
86
+ export class UserController {
87
+
88
+ @Inject()
89
+ storage: Storage;
90
+
91
+ @AuthUser()
92
+ user: User;
93
+
94
+ @Get('me')
95
+ async me() {
96
+ return this.auth.user;
97
+ }
98
+
99
+ @Get()
100
+ async browse() {
101
+ return UserModel.from(User.get());
102
+ }
103
+
104
+ @Get(':User')
105
+ read(user: User) {
106
+ return user;
107
+ }
108
+
109
+ @Put(':User')
110
+ update(user: User, userForm: UserForm) {
111
+ return user.fill(userForm).save();
112
+ }
113
+
114
+ @Post()
115
+ create(userForm: UserForm) {
116
+ return User.create(userForm);
117
+ }
118
+ }
119
+
120
+ ```
121
+
122
+ ## License
123
+ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typetron/framework",
3
3
  "description": "Modern Node.js framework for modern apps written in Typescript",
4
4
  "license": "MIT",
5
- "version": "0.5.8",
5
+ "version": "0.5.9",
6
6
  "keywords": [
7
7
  "typetron",
8
8
  "framework",
@@ -15,7 +15,7 @@
15
15
  "name": "Ionel Lupu"
16
16
  },
17
17
  "scripts": {
18
- "build": "tsc && cp package.json build/",
18
+ "build": "tsc && cp package.json build/ && cp Readme.md build/ && cp LICENSE.md build/ && cp package-lock.json build/",
19
19
  "dev": "tsc --watch",
20
20
  "test": "mocha",
21
21
  "test:watch": "mocha --watch",