This is a silly attempt to create a REST API using Go, as well as using Json Web Tokens to handle authenticated requests and generating refresh tokens so the user doesn't have to log in all the time
As a little extra, this API communicates to a database and gets data using raw SQL statements
I must clarify I have 0 experience when it comes to software, so I'm sure this project doesn't follow any standard or good practice. However, my goal is to learn a little bit more about this language and to create a useful base for my personal projects
That is literally all, this language is awesome
- Create the database using the provided script
- Go to the "backend" directory run on the terminal...
go run .
That's all, the server should be running now!
I read it is nice to have some stuff ia .env file, so you need to create it
- Create a .env file inside the "backend" directory
- Add the required variables to it, so far you need...
It is used to define the port you want to use on the server
It specifies the connection to the database using the postgres protocol
It is the key you use to sign your Json Web Tokens, it should be a secret
It is the frontend host you want to allow to perform requests, it usually will be http://localhost:4200 (For Angular)
`` SERVER_PORT=":3000" CONNECTION_STRING="postgresql://tasks:tasks@localhost?sslmode=disable" AUTH_KEY="super-secret-auth-key" ALLOWED_HOST="http://localhost:4200"