Accounts-MicroService-Crystal

An accounts (login and signup) microservice for future projects written in Crystal and Kemal.

Accounts Microservice

This microservice works using the Kemal Framework, uses MySQL as DBM (it doesn't have ORM... yet), encrypts the login data with JWT and receives and responds data using JSON.

[POST] /signup

Request format

{
  "name": "Fernando Murrieta",
  "email": "Fernando@gmail.com",
  "password": "Fernando1234"
}

[GET] /login

Request format

{
  "email": "Fernando@gmail.com",
  "password": "Fernando1234"
}

Note: after each login, it returns a JSON object with the authentication token which will last 1 hour.

Error Handlers

  • 400 Bad Request
  • 403 Forbidden
  • 404 Not Found
  • 405 Method Not Allowed

Running

As you can imagine, you need to have Crystal and MySQL or MariaDB to run it. In the root folder of the project run the command _shards install_ to install all de dependencies and then, to initialize the server you must run the command _crystal run src/server.cr_ and if everything goes well, it'll start.

Resources

  • MySQL / MariaDB

Crystal Dependences (shards)

  • crystal-mysql
  • jwt
  • kemal (branch master)
Owner
github statistic
  • 0
  • 0
  • 0
  • 0
  • 11 days ago
  • September 14, 2020
License

MIT License

Links
Synced at

Sat, 26 Sep 2020 14:29:00 GMT