Comments (2)
Create a middleware to handle such an instance by checking each route first.
app.register((req:any, res) => {
if(req.url.toString()=='/auth' || req.url.toString()=='/reg'){
return res;
}else{
let re =req.headers;
var obj = new Headers(re);
if(re.get('authorization')){
let values =re.get('authorization').split(' ')[1];
validateJwt(values,key).then((ress)=>{
answer=ress;
}).catch((err)=>{
err='Bad Token';
})
}
else{
err='No token found';
}
return answer?res: {
statusCode: 401,
content: err
};
}
});
from aqua.
I now introduced the provideFallback
function for handling requests with no matching route.
Example: Provide own fallback handler
from aqua.
Related Issues (20)
- error: Uncaught (in promise) Http: connection closed before message completed HOT 6
- Idea of enhancement: Headers HOT 1
- Use parameter instead of context for schemas
- Setting up Longpoll without Blocking HOT 4
- [Question] File Uploading HOT 3
- More logs if `log` option is enabled
- Group feature HOT 4
- How to send file upload request using javascript? HOT 2
- Support Deploy
- Add a `use` command to make changes to the `Aqua` instance
- Invalid route invoked HOT 2
- get user ip address HOT 2
- Response return type not exported HOT 3
- Aqua v1.3.0 will drop support for Deno versions < 1.13 HOT 1
- Alternative for app.render in 1.3.0? HOT 4
- Pass error type to the provided fallback handler
- [Question] How to get ? parameters? HOT 8
- static route at the root path does not work as expected HOT 2
- req.cookies is not filled HOT 5
- Cookies : add more control over creation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aqua.