create-sip 1.5.2 → 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.
@@ -1,6 +1,8 @@
1
- # sip expressapi template
1
+ # seper expressapi template
2
2
 
3
- Express based REST API template
3
+ Created by create-sip.
4
+
5
+ Express based REST API template.
4
6
 
5
7
  ## Install dependencies
6
8
 
@@ -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 dotenv from '@dotenvx/dotenvx'
5
- dotenv.config({ quiet: true })
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
+ });
@@ -15,22 +15,17 @@
15
15
  "author": "your name",
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
- "@dotenvx/dotenvx": "^1.51.0",
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
- "read": "^4.1.0",
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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-sip",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "main": "index.js",
5
5
  "bin": {
6
6
  "create-sip": "create-sip.js"