This repository has been archived on 2024-03-23. You can view files and clone it, but cannot push or open issues or pull requests.
ambition-legacy/backend
Abdulmujeeb Raji e08adc96ae feat(backend): Create Users and Get JWT
Introducing a unified signup and login API. You can post to the /user
route with credentials (so far just name and password), and if the user
doesn't exist, we create the user and return a token. If the user does
exist, if the password inputted matches the database password, we return
a token for that user, else we return an error.

i've never wanted to kms more during a programming session
2023-07-26 21:16:25 +01:00
..
sql feat(backend): Create Users and Get JWT 2023-07-26 21:16:25 +01:00
.gitignore feat(backend): Create Users and Get JWT 2023-07-26 21:16:25 +01:00
go.mod feat(backend): Create Users and Get JWT 2023-07-26 21:16:25 +01:00
go.sum feat(backend): Create Users and Get JWT 2023-07-26 21:16:25 +01:00
main.go feat(backend): Create Users and Get JWT 2023-07-26 21:16:25 +01:00
README.md feat(backend): Create Users and Get JWT 2023-07-26 21:16:25 +01:00
user.go feat(backend): Create Users and Get JWT 2023-07-26 21:16:25 +01:00
util.go feat(backend): Create Users and Get JWT 2023-07-26 21:16:25 +01:00

Backend Usage

In order for this to work, you need to have sqlite3 installed on your system. Once you do, make a databse called users.db and initialize it with the sql/init.sql script:

$ cat sql/init.sql | sqlite3 users.db

You also need to have a .env file in this folder, with the following options specified

  • JWT_SECRET: Used to encrypt tokens for user auth. Must be provided. Should be cryptographically secure
  • PORT: Optionally replace the default port of 7741