This server is written in Go and allows users to sign up and log in via the Resource Watch API. The server uses JWT for authentication and is built with the Gorilla Mux router, handling CORS configurations for cross-origin requests.
- Sign Up: Creates a new user on the Resource Watch platform.
- Log In: Authenticates a user and generates a JWT token for session management.
- Go installed
- Gorilla Mux for routing
- GoDotEnv for environment variable management
- JWT-Go for JWT handling
-
Clone the repository and navigate to the project directory.
-
Environment Variables: Create a copy of
.env.example
into a.env
file in the project root to store environment variables. It should contain the following keys:PORT=":5003" APP_NAME=resource_watch_app_name PGREST_SECRET=your_jwt_secret_shared_with_postgREST CALLBACK_URL=website_url RW_API_KEY=resource_watch_API_key DATABASE_URI=postgresql://
-
Install Dependencies:
Run the following commands to install necessary dependencies.
go get
go run main.go