mirror of
https://github.com/minoplhy/chhoto-url.git
synced 2024-11-22 17:26:45 +00:00
Cleaned up the auth a bit
This commit is contained in:
parent
f0e339e000
commit
25adf04903
@ -22,9 +22,11 @@ public class App {
|
|||||||
// Add GZIP compression
|
// Add GZIP compression
|
||||||
after(Filters::addGZIP);
|
after(Filters::addGZIP);
|
||||||
|
|
||||||
// Authenticate
|
// No need to auth in dev
|
||||||
Filter authFilter = Filters.createAuthFilter();
|
if(System.getenv("dev") == null) {
|
||||||
before("/index.html", authFilter);
|
// Authenticate
|
||||||
|
before("/api/*", Filters.createAuthFilter());
|
||||||
|
}
|
||||||
|
|
||||||
get("/", (req, res) -> {
|
get("/", (req, res) -> {
|
||||||
res.redirect("/index.html");
|
res.redirect("/index.html");
|
||||||
@ -33,7 +35,6 @@ public class App {
|
|||||||
|
|
||||||
|
|
||||||
path("/api", () -> {
|
path("/api", () -> {
|
||||||
before("/*", authFilter);
|
|
||||||
get("/all", Routes::getAll);
|
get("/all", Routes::getAll);
|
||||||
post("/new", Routes::addUrl);
|
post("/new", Routes::addUrl);
|
||||||
delete("/:shortUrl", Routes::delete);
|
delete("/:shortUrl", Routes::delete);
|
||||||
|
Loading…
Reference in New Issue
Block a user