Simple authentication service that allows users to sign up and log in. The service is built using Node.js, TypeScript, Express, and Postgres. At signup, a default organization is created using the user's first name.
- Clone the repository
- Run
npm installoryarn installto install dependencies- Create a
.envfile in the root directory and add the following environment variables:
DATABASE_URL- The URL to your Postgres databaseJWT_SECRET- A secret key for generating JWT tokensJWT_EXPIRY- The expiry time for JWT tokens- Run
npm run devoryarn devto start the server
The following endpoints are available:
POST /auth/register- New user registrationPOST /auth/login- User loginGET /api/users/:id- Get the current userGET /api/organisation/:orgId- Get the organization detailsPOST /api/organisations- Create a new organizationGET /api/organisations- Get all organizationsPOST /api/organisations/:orgId/users- Add a user to an organization