rewrote site with react

This commit is contained in:
2020-03-27 23:53:29 +05:00
parent b1b05baafd
commit 266a46446a
54 changed files with 299 additions and 27 deletions

36
server/app.js Normal file
View File

@ -0,0 +1,36 @@
const express = require('express')
const cors = require('cors')
const bodyParser = require('body-parser')
const fs = require('fs')
const app = express()
const port = 8000
app.use(cors())
app.get('/', (req, res) => {
fs.readdir('./assets/', (err, items) => {
result = items.map(el => 'image/' + el)
const pageSize = req.query.size || 3;
const pagesAmount = Math.ceil(items.length / pageSize );
const page = (req.query.page > pagesAmount) ? pagesAmount : req.query.page || 1;
console.log(`Page=${page}, server acessed`)
res.json({
"page": page,
"pagesAmount": pagesAmount,
"list": result.slice(page * pageSize - pageSize, page * pageSize),
})
})
})
app.get('/image/:name.:subname', (req, res) => {
res.sendFile(__dirname + '/assets/' + req.params.name + '.' + req.params.subname, (err) => {
console.log(__dirname + '/assets/' + req.params.name + '.' + req.params.subname)
if (err) {
next(err)
} else {
console.log('Sent:', req.query.path)
}
})
})
app.listen(port, () => console.log(`Example app listening on port ${port}!`))

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB