create-sipere 1.2.0 → 1.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-sipere",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "main": "create-sipere.js",
5
5
  "bin": {
6
6
  "create-sipere": "create-sipere.js"
@@ -4,11 +4,13 @@ import cors from 'cors'
4
4
  import fs from 'fs'
5
5
  import router from './routes/api.js'
6
6
  import './models/modrels.js'
7
+ import { UPLOAD_PATH } from './utils/paths.js'
7
8
 
8
9
  const app = express()
9
10
 
10
11
  const logfile = 'access.log'
11
12
  var accessLogStream = fs.createWriteStream(logfile, { flags: 'a' })
13
+ app.use('/images', express.static(UPLOAD_PATH))
12
14
  app.use(morgan('dev', { stream: accessLogStream }))
13
15
  app.use(cors())
14
16
  app.use(express.json())
@@ -0,0 +1,10 @@
1
+ import { fileURLToPath } from 'url';
2
+ import { dirname, resolve, join } from 'path';
3
+
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = dirname(__filename);
6
+
7
+ const ROOT_DIR = resolve(__dirname, '../..');
8
+ const UPLOAD_PATH = join(ROOT_DIR, 'public', 'uploads');
9
+
10
+ export { ROOT_DIR, UPLOAD_PATH }