create-sip 1.5.1 → 1.5.3
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.
package/expressapi/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import bcrypt from 'bcryptjs'
|
|
2
2
|
import jwt from 'jsonwebtoken'
|
|
3
3
|
import User from '../models/user.js'
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import dotenvFlow from 'dotenv-flow';
|
|
5
|
+
dotenvFlow.config()
|
|
6
6
|
|
|
7
7
|
const AuthController = {
|
|
8
8
|
async register(req, res) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import multer from 'multer';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
const storage = multer.diskStorage({
|
|
5
|
+
destination: function (req, file, cb) {
|
|
6
|
+
cb(null, 'public/uploads');
|
|
7
|
+
},
|
|
8
|
+
filename: function (req, file, cb) {
|
|
9
|
+
cb(null, Date.now() + path.extname(file.originalname));
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const upload = multer({
|
|
14
|
+
storage: storage,
|
|
15
|
+
limits: { fileSize: 1024 * 1024 * 5 }, // 5MB
|
|
16
|
+
fileFilter: function (req, file, cb) {
|
|
17
|
+
const ext = path.extname(file.originalname);
|
|
18
|
+
if (ext !== '.png' && ext !== '.jpg' && ext !== '.jpeg') {
|
|
19
|
+
return cb(new Error('Only images are allowed'));
|
|
20
|
+
}
|
|
21
|
+
cb(null, true);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
// import sequelize from '../database/database.js'
|
|
1
2
|
import User from './user.js';
|
|
2
|
-
import sequelize from '../database/database.js'
|
|
3
3
|
|
|
4
4
|
const db = {};
|
|
5
5
|
|
|
6
6
|
db.User = User;
|
|
7
7
|
|
|
8
|
-
await sequelize.sync({
|
|
9
|
-
alter: true
|
|
10
|
-
})
|
|
8
|
+
// await sequelize.sync({ alter: true })
|
|
11
9
|
|
|
12
10
|
export default db;
|
package/expressapi/package.json
CHANGED
|
@@ -15,22 +15,17 @@
|
|
|
15
15
|
"author": "your name",
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"@sipere/op-cli": "^0.9.2",
|
|
18
|
+
"@sipere/op-cli": "^0.9.4",
|
|
20
19
|
"bcryptjs": "^2.4.3",
|
|
21
20
|
"cors": "^2.8.5",
|
|
22
21
|
"dotenv-flow": "^4.1.0",
|
|
23
22
|
"express": "^4.18.2",
|
|
24
|
-
"generate-api-key": "^1.0.2",
|
|
25
23
|
"jsonwebtoken": "^9.0.0",
|
|
26
24
|
"mariadb": "^3.1.2",
|
|
27
25
|
"morgan": "^1.10.0",
|
|
28
|
-
"
|
|
29
|
-
"replace": "^1.2.2",
|
|
26
|
+
"multer": "^2.0.2",
|
|
30
27
|
"sequelize": "^6.32.0",
|
|
31
|
-
"sqlite3": "^5.1.6"
|
|
32
|
-
"umzug": "^3.8.2",
|
|
33
|
-
"yargs": "^18.0.0"
|
|
28
|
+
"sqlite3": "^5.1.6"
|
|
34
29
|
},
|
|
35
30
|
"devDependencies": {
|
|
36
31
|
"@types/bcryptjs": "^2.4.6",
|