typescript(translucid): fixed bugs
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
46fdc8a70a
commit
43a4771148
|
@ -19,7 +19,7 @@ class Translucid {
|
||||||
bind(path = "/", filepath = "", text = false, classes = []) {
|
bind(path = "/", filepath = "", text = false, classes = []) {
|
||||||
this.app.get(path, async (req, res) => {
|
this.app.get(path, async (req, res) => {
|
||||||
if (!text) {
|
if (!text) {
|
||||||
res.sendFile(`${__dirname}/../../${filepath}`);
|
res.sendFile(`${__dirname}/${filepath}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const readResults = await read_1.read(filepath);
|
const readResults = await read_1.read(filepath);
|
||||||
|
|
|
@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
function read(url) {
|
function read(url) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
fs.readFile(`./${url}`, "utf8", (err, data) => {
|
fs.readFile(`${__dirname}/${url}`, "utf8", (err, data) => {
|
||||||
if (err)
|
if (err)
|
||||||
reject(err);
|
reject(err);
|
||||||
resolve(data);
|
resolve(data);
|
||||||
|
|
Loading…
Reference in a new issue