Skip to content
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

Bug #9

Closed
Enkratia opened this issue Sep 25, 2023 · 3 comments
Closed

Bug #9

Enkratia opened this issue Sep 25, 2023 · 3 comments

Comments

@Enkratia
Copy link

Enkratia commented Sep 25, 2023

Hello,

In module usage everything is working perfect, but /register - does not register new users, it says - you must add "users" (but "users" already exist). Paradox: at the same time /register knows that your email was registered, by checking it in "users" and it sends message : "email already exist".

*User registered earlier localy.

const jsonServer = require("json-server");
const auth = require("json-server-auth");

const server = jsonServer.create();
const router = jsonServer.router("db.json");
const middlewares = jsonServer.defaults();

server.db = router.db;

// Add this before server.use(router)
server.use(middlewares);
server.use(auth);

server.use(router);
server.listen(3000, () => {
  console.log("JSON Server is running");
});

// Export the Server API
module.exports = server;
@Enkratia Enkratia changed the title POST request - 404 Bug Sep 27, 2023
@whoafridi
Copy link

waiting for fixing ..

@kitloong
Copy link
Owner

kitloong commented Oct 4, 2023

Hi @Enkratia , I am sorry for the dealy.

Please follow #6 (comment) to enable write operations.

@Enkratia
Copy link
Author

Enkratia commented Oct 5, 2023

Thanks to you @kitloong and to @VicAv99. Now it works.

@Enkratia Enkratia closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants