Skip to content

Commit a7884b3

Browse files
committed
started now
1 parent e46bdea commit a7884b3

File tree

5 files changed

+30
-43
lines changed

5 files changed

+30
-43
lines changed

README.md

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
1-
<div align="center"> <a href="https://fastify.io/">
2-
<img
3-
src="./public/assets/banner.png"
4-
width="650"
5-
height="auto"
6-
/>
7-
</a>
8-
</div>
91

102

11-
12-
13-
<br />
3+
![logo](https://github.com/aframson/leafjs/raw/main/public/assets/banner.png)
144

155
An efficient server implies a lower cost of the infrastructure, a better
166
responsiveness under load and happy users. How can you efficiently handle the
@@ -28,14 +18,8 @@ It is inspired by Nodejs , Express , Socket.io , Mysql ,MongoDB and as far as we
2818

2919
## The Abstracted Realtime & REST API Server Framework
3020

31-
<div align="center"> <a href="https://fastify.io/">
32-
<img
33-
src="./public/assets/arc.png"
34-
width="650"
35-
height="auto"
36-
/>
37-
</a>
38-
</div>
21+
![logo](https://github.com/aframson/leafjs/raw/main/public/assets/arc.png)
22+
3923
leaf.js is a server container consisting of the following stacks
4024
- node
4125
- socket.io

configs/app.js

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,30 @@
44
* =======================================================================
55
*/
66

7-
const express = require('express')
8-
const log = require('morgan')
9-
const cors = require('cors')
10-
const cookieParser = require('cookie-parser')
11-
const multer = require('multer')
12-
const upload = multer()
13-
14-
module.exports = (app) => {
15-
// to prevent cors errors
16-
app.use(cors());
17-
// log requests to the console
18-
app.use(log('tiny'));
19-
// parse application/json
20-
app.use(express.json());
21-
// parse raw text
22-
app.use(express.text());
23-
// parse application/x-www-form-urlencoded
24-
app.use(express.urlencoded({ extended: true }));
25-
app.use(cookieParser());
26-
// parse multipart/form-data
27-
app.use(upload.array());
28-
// allow static files
29-
app.use(express.static('public'));
30-
}
7+
const express = require('express')
8+
const log = require('morgan')
9+
const cors = require('cors')
10+
const cookieParser = require('cookie-parser')
11+
const multer = require('multer')
12+
const upload = multer()
13+
const {basicAuth} = require('../middlewares/index')
14+
15+
module.exports = (app) => {
16+
// add the custom middleware
17+
app.use(basicAuth)
18+
// to prevent cors errors
19+
app.use(cors());
20+
// log requests to the console
21+
app.use(log('tiny'));
22+
// parse application/json
23+
app.use(express.json());
24+
// parse raw text
25+
app.use(express.text());
26+
// parse application/x-www-form-urlencoded
27+
app.use(express.urlencoded({ extended: true }));
28+
app.use(cookieParser());
29+
// parse multipart/form-data
30+
app.use(upload.array());
31+
// allow static files
32+
app.use(express.static('public'));
33+
}

public/assets/arc.png

254 KB
Loading

public/assets/banner.png

1.49 MB
Loading

public/assets/leaf.png

411 KB
Loading

0 commit comments

Comments
 (0)