VueJS lekcja 1
This commit is contained in:
1 parent
11eb98f6b7
commit
e66b5ebc22
602 files changed
+63992
No files matched your search
@@ -0,0 +1,36 @@
|
||||
const fs = require('fs');
|
||||
const main_dir = 'cwiczenia';
|
||||
|
||||
const sub_dirs = fs.readdirSync(__dirname + "/static/" + main_dir);
|
||||
|
||||
const data = {
|
||||
folders: sub_dirs,
|
||||
lessons: []
|
||||
};
|
||||
|
||||
data.folders.forEach(folder => {
|
||||
data.lessons.push(fs.readdirSync(__dirname + "/static/" + main_dir + "/" + folder));
|
||||
});
|
||||
|
||||
console.log(data);
|
||||
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const path = require('path');
|
||||
const PORT = 3000;
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.sendFile(path.join(__dirname, 'static/pages/index2.html'));
|
||||
});
|
||||
|
||||
app.get('/page_list', function (req, res) {
|
||||
res.send(data);
|
||||
});
|
||||
|
||||
app.use(express.static('static/css'));
|
||||
app.use(express.static('static/gfx'));
|
||||
app.use(express.static('static/' + main_dir));
|
||||
|
||||
app.listen(PORT, function () {
|
||||
console.log(`Start serwera, port: ${PORT}`);
|
||||
});
|
||||
Reference in new issue
Block a user