Welcome to the Event Booking System! This project is designed to help users book events seamlessly.
To get a local copy up and running, follow these simple steps.
-
Clone the repository
git clone https://github.com/21amir21/event-booking.git
-
Navigate to the project directory
cd event-booking -
Build the project
go build
The application requires certain environment variables to be set, especially for JWT (JSON Web Tokens) configuration. These variables should be defined in a .env file in the root of your project.
-
Create a
.envfile:touch .env
-
Add the following environment variables to the
.envfile:JWT_SECRET=your_jwt_secret_key JWT_EXPIRATION_TIME=7200 # Time in seconds,, no need to add it, the code handles it for now
JWT_SECRET: A secret key used to sign the JWT tokens. It should be a strong, random string.JWT_EXPIRATION_TIME: The expiration time for the JWT tokens in seconds.
To start the server, run:
./event-bookingTo build and run the application using Docker, follow these steps:
-
Build the Docker Image:
docker build --no-cache -t event-booking . -
Run the Docker Container:
docker run -p 8080:8080 --rm -v $(pwd):/app -v /app/tmp --name event-booking-ctr event-booking -
View Logs:
If you need to view the logs of the running container, use:
docker logs event-booking-ctr
By using Docker, you can ensure that the application runs in a consistent environment, regardless of the host operating system.
- The API uses JSON Web Tokens (JWT) for authenticating users.
- Users must login to receive a token, which must be included in the
Authorizationheader for protected routes.
- Create, update, delete, and view events.
- Only authenticated users can create events.
- Events can only be updated or deleted by their creators.
- Users can sign up to create an account.
- Authentication is required to access most features.
- Users can register for events.
- Users can cancel their registrations for events.