bugfix
This commit is contained in:
parent
b5a0624633
commit
a891912817
@ -1,6 +1,8 @@
|
|||||||
const router = require('express').Router();
|
const router = require('express').Router();
|
||||||
|
|
||||||
router.use('/users', require('../users/api.js'));
|
// router.use('/users', require('../users/api.js'));
|
||||||
router.use('/files', require('../files/api.js'));
|
// router.use('/files', require('../files/api.js'));
|
||||||
|
|
||||||
|
router.use('/files', require('../files/api.js'))
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
@ -1,6 +1,39 @@
|
|||||||
const router = require('express').Router();
|
const router = require('express').Router();
|
||||||
const { getJsonFile } = require('./json');
|
const { getJsonFile } = require('./json');
|
||||||
|
const {join} = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
require('dotenv').config();
|
||||||
|
const env = process.env;
|
||||||
|
const root = join(__dirname, '../../');
|
||||||
|
|
||||||
router.get('/json/:filename', getJsonFile);
|
// router.get('/json/:filename', getJsonFile);
|
||||||
|
router.get('/cards/:filename', (req, res) => {
|
||||||
|
|
||||||
|
const filePath = join(root, `${env.FILE_PATH}/cards/${req.params.filename}.${req.query.type}`);
|
||||||
|
|
||||||
|
fs.readFile(filePath, (err, data) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
return res.status(500).send('Error reading file');
|
||||||
|
}
|
||||||
|
|
||||||
|
res.setHeader('Content-Type', 'application/json');
|
||||||
|
res.send(data);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
router.get('/notes/:filename', (req, res) => {
|
||||||
|
const filePath = join(root, `${env.FILE_PATH}/notes/${req.params.filename}.${req.query.type}`);
|
||||||
|
|
||||||
|
fs.readFile(filePath, (err, data) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
return res.status(500).send('Error reading file');
|
||||||
|
}
|
||||||
|
|
||||||
|
res.setHeader('Content-Type', 'text/html');
|
||||||
|
res.send(data);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
@ -2,4 +2,8 @@ LISTEN_PORT=3000
|
|||||||
JWT_SECRET=123456
|
JWT_SECRET=123456
|
||||||
DATABASE_NAME=sqlite3.db
|
DATABASE_NAME=sqlite3.db
|
||||||
ADMIN_LOGIN_NAME=admin
|
ADMIN_LOGIN_NAME=admin
|
||||||
ADMIN_LOGIN_PASSWORD=admin
|
ADMIN_LOGIN_PASSWORD=admin
|
||||||
|
|
||||||
|
MOD=
|
||||||
|
STATIC_PATH=./static
|
||||||
|
HOME_PATH=./home
|
9
start.py
9
start.py
@ -13,11 +13,10 @@ def main():
|
|||||||
# Define the commands you want to run
|
# Define the commands you want to run
|
||||||
commands = [
|
commands = [
|
||||||
# 'git clone https://github.com/yourusername/yourproject.git',
|
# 'git clone https://github.com/yourusername/yourproject.git',
|
||||||
'cd vue-project',
|
'cd vue-project && git pull',
|
||||||
'git pull',
|
'cd vue-project && npm install',
|
||||||
'npm install',
|
'cd vue-project && npm run build',
|
||||||
'npm run build',
|
|
||||||
'cd ..',
|
|
||||||
'git pull',
|
'git pull',
|
||||||
'npm install',
|
'npm install',
|
||||||
'cp -r vue-project/dist/* ./dist'
|
'cp -r vue-project/dist/* ./dist'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user