Skip to content

Commit

Permalink
Add path checker and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
CMEONE committed Mar 4, 2021
1 parent 085bef2 commit a77be68
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class tApp {
static cache = {};
static cacheSize = 0;
static get version() {
return "v0.2.0";
return "v0.2.1";
}
static configure(params) {
if(params == null) {
Expand Down Expand Up @@ -69,7 +69,11 @@ class tApp {
};
}
static route(path, renderFunction) {
tApp.routes[path] = renderFunction;
if(path == "/" || path.substring(0, 1) == "#") {
tApp.routes[path] = renderFunction;
} else {
throw "tAppError: Invalid path, the path can only be \"/\" or start with \"#\".";
}
}
static get(path) {
return new Promise((resolve, reject) => {
Expand Down

0 comments on commit a77be68

Please sign in to comment.