Skip to main content

register

function register(payload: Object)
async

Registers a new user with the given payload and returns a JWT token along with user details.

Returns: Promise<Object>

  • The response data from the server.
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
payloadObjectThe registration details (e.g., username, password).
import auth from "@pr4j3sh/auth";

const payload = {
username: "johndoe",
password: "securepassword123"
};

const res = await auth.register(payload);
console.log(res);