adds random route
This commit is contained in:
parent
2c4a25f257
commit
86b826788e
|
@ -274,6 +274,13 @@ http.createServer((req, res) => {
|
||||||
res.end(tpl(data), 'utf-8');
|
res.end(tpl(data), 'utf-8');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else if(filePath == "./random") {
|
||||||
|
sql.query("select `id` from `f0ck`.`items` order by rand() limit 1", null, (err, rows, fields) => {
|
||||||
|
res.writeHead(301, {
|
||||||
|
Location: req.headers.host + '/' + rows[0][0].id
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
else if(filePath == "./how") {
|
else if(filePath == "./how") {
|
||||||
var tpl = swig.compile(templates.how);
|
var tpl = swig.compile(templates.how);
|
||||||
res.writeHead(200, { 'Content-Type': 'text/html' });
|
res.writeHead(200, { 'Content-Type': 'text/html' });
|
||||||
|
|
Loading…
Reference in New Issue
Block a user