1
+ # frourio-express
2
+ <br />
1
3
<br />
2
4
<div align =" center " >
3
- <img src =" https://frouriojs.github.io/frourio/assets/images/ogp.png " width =" 1280 " alt =" frourio " />
5
+ <img src =" https://frouriojs.github.io/frourio/assets/images/ogp.png " width =" 1280 " alt =" frourio-express " />
4
6
</div >
5
7
6
8
<div align =" center " >
7
- <a href =" https://www.npmjs.com/package/frourio " >
8
- <img src="https://img.shields.io/npm/v/frourio" alt="npm version" />
9
+ <a href =" https://www.npmjs.com/package/frourio-express " >
10
+ <img src="https://img.shields.io/npm/v/frourio-express " alt="npm version" />
9
11
</a >
10
- <a href =" https://github. com/frouriojs /frourio/actions?query=workflow%3A%22Node.js+CI%22 " >
11
- <img src="https://github.com/frouriojs/frourio/workflows/Node.js%20CI/badge.svg?branch=master " alt="Node.js CI " />
12
+ <a href =" https://www.npmjs. com/package /frourio-express " >
13
+ <img src="https://img.shields.io/npm/dm/frourio-express " alt="npm download " />
12
14
</a >
13
- <a href =" https://codecov.io/gh/ frouriojs/frourio " >
14
- <img src="https://img.shields.io/codecov/c/github/frouriojs/frourio .svg" alt="Codecov " />
15
+ <a href =" https://github.com/ frouriojs/frourio-express/actions?query=workflow%3A%22Node.js+CI%22 " >
16
+ <img src="https://github.com/frouriojs/frourio-express/workflows/Node.js%20CI/badge .svg?branch=master " alt="Node.js CI " />
15
17
</a >
16
- <a href =" https://lgtm.com/projects/g/ frouriojs/frourio/context:javascript " >
17
- <img src="https://img.shields.io/lgtm/grade/javascript/g/ frouriojs/frourio.svg" alt="Language grade: JavaScript " />
18
+ <a href =" https://codecov.io/gh/ frouriojs/frourio-express " >
19
+ <img src="https://img.shields.io/codecov/c/github/ frouriojs/frourio-express .svg" alt="Codecov " />
18
20
</a >
19
- <a href =" https://github .com/frouriojs/frourio/blob/master/packages/ frourio/LICENSE " >
20
- <img src="https://img.shields.io/npm/l/ frourio" alt="License " />
21
+ <a href =" https://lgtm .com/projects/g/frouriojs/ frourio-express/context:javascript " >
22
+ <img src="https://img.shields.io/lgtm/grade/javascript/g/frouriojs/ frourio-express.svg " alt="Language grade: JavaScript " />
21
23
</a >
22
24
</div >
23
25
24
- <p align =" center " >Frourio is a perfectly type-checkable REST framework for TypeScript.</p >
26
+ <p align =" center " >Frourio-express is a perfectly type-checkable REST framework for TypeScript.</p >
25
27
<br />
26
28
<br />
27
29
<br />
28
30
29
- ## Why frourio ?
31
+ ## Why frourio-express ?
30
32
31
33
Even if you write both the front and server in TypeScript, you can't statically type-check the API's sparsity.
32
34
33
35
We are always forced to write "Two TypeScript".
34
36
We waste a lot of time on dynamic testing using the browser and Docker.
35
37
36
- Frourio is a framework for developing web apps quickly and safely in "One TypeScript".
37
-
38
38
<div align =" center " >
39
- <img src =" https://frouriojs.github.io/frourio/assets/images/problem.png " width =" 900 " alt =" Why frourio ? " />
39
+ <img src =" https://frouriojs.github.io/frourio/assets/images/problem.png " width =" 1200 " alt =" Why frourio ? " />
40
40
</div >
41
+ <br />
41
42
42
-
43
- ## Architecture
44
-
45
- In order to develop in "One TypeScript", ` frourio ` and ` aspida ` need to cooperate with each other.
46
- You can use ` create-frourio-app ` to make sure you don't fail in building your environment.
47
-
48
- You can choose between Next.js or Nuxt.js for the front framework.
49
- Frourio is based on Express.js, so it's not difficult.
50
-
51
- ORM setup is also completed automatically, so there is no failure in connecting to the DB.
52
-
53
- Once the REST API endpoint interface is defined, the server controller implementation is examined by the type.
54
- The front is checked by the type to see if it is making an API request as defined in the interface.
55
-
56
- [ aspida: TypeScript friendly HTTP client wrapper for the browser and node.js.] ( https://github.com/aspidajs/aspida )
43
+ Frourio-express is a framework for developing web apps quickly and safely in "One TypeScript".
57
44
58
45
<div align =" center " >
59
- <img src =" https://frouriojs.github.io/frourio/assets/images/architecture.png " width =" 900 " alt =" Architecture of create-frourio-app " />
46
+ <img src =" https://frouriojs.github.io/frourio/assets/images/architecture.png " width =" 1200 " alt =" Architecture of create-frourio-app " />
60
47
</div >
48
+ <br />
49
+ <br />
61
50
62
51
## Table of Contents
63
52
64
53
- [ Install] ( #Install )
54
+ - [ Fastify.js mode] ( #Fastifyjs )
65
55
- [ Environment] ( #Environment )
66
56
- [ Entrypoint] ( #Entrypoint )
67
57
- [ Controller] ( #Controller )
@@ -109,9 +99,19 @@ Or with [yarn](https://yarnpkg.com/en/):
109
99
$ yarn create frourio-app < my-project>
110
100
```
111
101
102
+ <a id =" Fastifyjs " ></a >
103
+
104
+ ## Fastify.js mode
105
+
106
+ Frourio-express uses express.js as its HTTP server.
107
+ If you choose fastify.js in create-frourio-app, please refer to the following repositories.
108
+ [ GitHub: frourio] ( https://github.com/frouriojs/frourio )
109
+
110
+ Note: frourio is 5x faster than frourio-express
111
+
112
112
## Environment
113
113
114
- Frourio requires TypeScript 3.9 or higher.
114
+ Frourio-express requires TypeScript 3.9 or higher.
115
115
If the TypeScript version of VSCode is low, an error is displayed during development.
116
116
117
117
## Entrypoint
@@ -120,7 +120,7 @@ If the TypeScript version of VSCode is low, an error is displayed during develop
120
120
121
121
``` ts
122
122
import express from ' express'
123
- import server from ' ./$server' // '$server.ts' is automatically generated by frourio
123
+ import server from ' ./$server' // '$server.ts' is automatically generated by frourio-express
124
124
125
125
const app = express ()
126
126
@@ -167,7 +167,7 @@ export type Methods = {
167
167
` server /api /tasks /controller .ts `
168
168
169
169
` ` ` ts
170
- import { defineController } from ' ./$relay' // '$relay.ts' is automatically generated by frourio
170
+ import { defineController } from ' ./$relay' // '$relay.ts' is automatically generated by frourio-express
171
171
import { getTasks } from ' $/service/tasks'
172
172
173
173
export default defineController (() => ({
@@ -199,7 +199,7 @@ export type Methods = {
199
199
` server /api /tasks /controller .ts `
200
200
201
201
` ` ` ts
202
- import { defineController } from ' ./$relay' // '$relay.ts' is automatically generated by frourio
202
+ import { defineController } from ' ./$relay' // '$relay.ts' is automatically generated by frourio-express
203
203
import { createTask } from ' $/service/tasks'
204
204
205
205
export default defineController (() => ({
@@ -230,7 +230,7 @@ export type Methods = {
230
230
` server /api /tasks /_taskId @number /controller .ts `
231
231
232
232
` ` ` ts
233
- import { defineController } from ' ./$relay' // '$relay.ts' is automatically generated by frourio
233
+ import { defineController } from ' ./$relay' // '$relay.ts' is automatically generated by frourio-express
234
234
import { findTask } from ' $/service/tasks'
235
235
236
236
export default defineController (() => ({
@@ -244,7 +244,7 @@ export default defineController(() => ({
244
244
245
245
## Hooks
246
246
247
- Frourio can use all of Express.js' middleware as hooks.
247
+ Frourio-express can use all of Express.js' middleware as hooks.
248
248
There are four types of hooks, onRequest / preParsing / preValidation / preHandler.
249
249
250
250
### Lifecycle
@@ -280,7 +280,7 @@ Directory level hooks are called at the current and subordinate endpoints.
280
280
` server/api/tasks/hooks.ts `
281
281
282
282
``` ts
283
- import { defineHooks } from ' ./$relay' // '$relay.ts' is automatically generated by frourio
283
+ import { defineHooks } from ' ./$relay' // '$relay.ts' is automatically generated by frourio-express
284
284
285
285
export default defineHooks (() => ({
286
286
onRequest: [
@@ -309,7 +309,7 @@ Controller level hooks are called at the current endpoint after directory level
309
309
` server/api/tasks/controller.ts `
310
310
311
311
``` ts
312
- import { defineHooks , defineController } from ' ./$relay' // '$relay.ts' is automatically generated by frourio
312
+ import { defineHooks , defineController } from ' ./$relay' // '$relay.ts' is automatically generated by frourio-express
313
313
import { getTasks , createTask } from ' $/service/tasks'
314
314
315
315
export const hooks = defineHooks (() => ({
@@ -362,7 +362,7 @@ $ yarn add @types/passport --dev
362
362
363
363
``` ts
364
364
import passport from ' passport'
365
- import { defineHooks } from ' ./$relay' // '$relay.ts' is automatically generated by frourio
365
+ import { defineHooks } from ' ./$relay' // '$relay.ts' is automatically generated by frourio-express
366
366
import { getUserIdByToken } from ' $/service/user'
367
367
368
368
// Export the User in hooks.ts to receive the user in controller.ts
@@ -690,7 +690,7 @@ https://github.com/expressjs/multer#multeropts
690
690
691
691
``` ts
692
692
import express from ' express'
693
- import server from ' ./$server' // '$server.ts' is automatically generated by frourio
693
+ import server from ' ./$server' // '$server.ts' is automatically generated by frourio-express
694
694
695
695
const app = express ()
696
696
@@ -944,4 +944,4 @@ Ran all test suites.
944
944
945
945
# # License
946
946
947
- Frourio is licensed under a [MIT License](https://github.com/frouriojs/frourio/blob/master/packages/frourio /LICENSE).
947
+ Frourio-express is licensed under a [MIT License](https://github.com/frouriojs/frourio-express /blob/master/LICENSE).
0 commit comments