-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Auth #1405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
/auth/login and /auth/register (login and registering users) should be considered out-of-scope for this project One could assert some basic authentication and authorization could be added though. Json-serevr is built on top of express, so there's easy ways to achieve that. |
The Problem using The way expressjs is with Options and it complete does not use the expand or embed relations |
https://github.com/jeremyben/json-server-auth look like it's what you are looking for and me too. |
?
…On Thu, Sep 28, 2023, 9:32 AM Tiarra Little ***@***.***> wrote:
https://github.com/jeremyben/json-server-auth look like it's what you are
looking for and me too.
—
Reply to this email directly, view it on GitHub
<#1405 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AESWQJVPGR4TCT2GALJFT73X4V4ADANCNFSM6AAAAAAU7QR7FU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Can hack json-server module.exports = (util) => {
return {
api: {
// For example, permission checks can be created at all entry points
'use /' (req, res, next) {
if(req.headers.token === undefined) {
res.status(403).json({msg: `No permission`})
} else {
next()
}
},
// Intercepts any requests sent to db.json, and responses from db.josn
'patch /books/:id' (req, res, next) { // intercept config.db
req.body.a = `111` // Modify the data passed in by the user
next()
res.mm.resHandleJsonApi = async (arg) => {
arg.data.a = `222` // Modify the response, it will not be stored in db.json
return arg.resHandleJsonApi(arg)
}
},
},
db: {
books: [
{
id: 1,
title: `css`,
},
],
},
}
} |
Hi
I was working with this amazing package and suddenly it came to my mind:
Can we have default Auth routes? like
/auth/login
/auth/register
If it is possible, let me create it and add pr.
Thanks
The text was updated successfully, but these errors were encountered: