This project is a RESTful API built with Go using the Fiber framework. It uses MySQL for data storage and Redis for caching.
- Clone the repository:
git clone https://github.com/maskedeman/api-project.git
- Navigate to the project directory:
cd api-project - Initialize:
go mod init api-project
- Install dependencies:
go mod tidy
The project is configured via a config.json file. Here's a brief explanation of each setting:
server: The domain and port where the server will run.database: The configuration for the MySQL database.jwt: The secrets and expiry times for JWT tokens.redis: The configuration for the Redis cache.security: The entropy for password hashing.verbose: Whether to run the server in verbose mode.logger: Whether to enable logging.
Adjust these settings as per the given config.json.example file. Make a new file config.json in internal/config and copy the contents of config.json.example file present in the same directory before running the project.
You can run the project in two modes:
- Normal mode:
make run
- Watch mode (the server will restart on file changes):
make run watch-mode
- To tidy up dependencies:
make tidy
- To run database migrations:
make migrate
- To lint the code:
make lint
- Postman collections along with environment are available in postman-collection folder for convenience. Change the environment to the given environment - "beta" and also change the baseURL accordingly or you can configure the environment as per your convenience.