{"info":{"_postman_id":"e2a9f5db-88cd-4f4f-bef6-a6b97315f438","name":"Event management API - Go","description":"<html><head></head><body><h1 id=\"go-server-project\">Go-Server Project</h1>\n<img src=\"https://blog.golang.org/gopher/header.jpg\" alt=\"Go Logo\">\n\n<h2 id=\"overview\">Overview</h2>\n<p>The <strong>Go-Server</strong> project is a simple web application built with Go, utilizing the Gin framework for routing, and PostgreSQL as the database. This project demonstrates the core principles of building and deploying a RESTful API with JWT authentication, focusing on managing events and user registration.</p>\n<h3 id=\"features\">Features</h3>\n<ul>\n<li><p><strong>User Authentication</strong>: Secure login and signup functionality with JWT tokens.</p>\n</li>\n<li><p><strong>Event Management</strong>: Create, retrieve, update, and delete events.</p>\n</li>\n<li><p><strong>User Event Registration</strong>: Register and unregister for events.</p>\n</li>\n<li><p><strong>Dockerized Deployment</strong>: Easy deployment using Docker and Docker Compose.</p>\n</li>\n</ul>\n<h3 id=\"core-technologies\">Core Technologies</h3>\n<ul>\n<li><p><strong>Programming Language</strong>: Go</p>\n</li>\n<li><p><strong>Framework</strong>: Gin</p>\n</li>\n<li><p><strong>Database</strong>: PostgreSQL</p>\n</li>\n<li><p><strong>Authentication</strong>: JWT (JSON Web Tokens)</p>\n</li>\n<li><p><strong>Containerization</strong>: Docker</p>\n</li>\n</ul>\n<h2 id=\"endpoints\">Endpoints</h2>\n<h3 id=\"event-routes\">Event Routes</h3>\n<ul>\n<li><p><strong>GET /events</strong></p>\n<ul>\n<li>Fetch all events.</li>\n</ul>\n</li>\n<li><p><strong>GET /events/:id</strong></p>\n<ul>\n<li>Fetch a specific event by ID.</li>\n</ul>\n</li>\n<li><p><strong>POST /events</strong></p>\n<ul>\n<li>Create a new event (requires authentication).</li>\n</ul>\n</li>\n<li><p><strong>PUT /events/:id</strong></p>\n<ul>\n<li>Update an event by ID (requires authentication).</li>\n</ul>\n</li>\n<li><p><strong>DELETE /events/:id</strong></p>\n<ul>\n<li>Delete an event by ID (requires authentication).</li>\n</ul>\n</li>\n<li><p><strong>POST /register</strong></p>\n<ul>\n<li>Register for an event (requires authentication).</li>\n</ul>\n</li>\n<li><p><strong>POST /unregister</strong></p>\n<ul>\n<li>Unregister from an event (requires authentication).</li>\n</ul>\n</li>\n</ul>\n<h3 id=\"user-routes\">User Routes</h3>\n<ul>\n<li><p><strong>POST /signup</strong></p>\n<ul>\n<li>Create a new user account.</li>\n</ul>\n</li>\n<li><p><strong>POST /login</strong></p>\n<ul>\n<li>Authenticate and log in to receive a JWT token.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"setup-and-installation\">Setup and Installation</h2>\n<h3 id=\"prerequisites\">Prerequisites</h3>\n<ul>\n<li><p>Docker installed on your machine</p>\n</li>\n<li><p>Docker Compose installed</p>\n</li>\n</ul>\n<h3 id=\"running-the-application\">Running the Application</h3>\n<ol>\n<li><p>git clone <a href=\"https://github.com/tejasvi541/Go-Server.gitcd\">https://github.com/tejasvi541/Go-Server.gitcd</a> Go-Server</p>\n</li>\n<li><p>docker-compose up --build</p>\n</li>\n<li><p>The server will run on <code>http://localhost:8080</code>.</p>\n<ul>\n<li><p>Use tools like Postman or curl to interact with the endpoints.</p>\n</li>\n<li><p>Ensure to include the JWT token in the <code>Authorization</code> header for routes that require authentication.</p>\n</li>\n</ul>\n</li>\n</ol>\n<h3 id=\"docker-image\">Docker Image</h3>\n<p>The Docker image for this project can be found on <a href=\"https://hub.docker.com/repository/docker/tejasvix/go-server\">Docker Hub</a>.</p>\n<h3 id=\"environment-variables\">Environment Variables</h3>\n<p>You can configure the following environment variables in the <code>.env</code> file:</p>\n<ul>\n<li><p><code>DB_HOST</code>: Database host (default is <code>localhost</code>)</p>\n</li>\n<li><p><code>DB_PORT</code>: Database port (default is <code>5432</code>)</p>\n</li>\n<li><p><code>DB_USER</code>: Database username (default is <code>postgres</code>)</p>\n</li>\n<li><p><code>DB_PASSWORD</code>: Database password</p>\n</li>\n<li><p><code>DB_NAME</code>: Database name (default is <code>events</code>)</p>\n</li>\n<li><p><code>JWT_SECRET</code>: Secret key for JWT tokens</p>\n</li>\n</ul>\n<h2 id=\"contributing\">Contributing</h2>\n<p>Contributions are welcome! Please fork the repository and create a pull request to contribute to this project.</p>\n<h2 id=\"license\">License</h2>\n<p>This project is licensed under the MIT License.</p>\n<hr>\n<p>Happy coding! 🎉</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[{"content":"Go-Server Project","slug":"go-server-project"}],"owner":"13991317","collectionId":"e2a9f5db-88cd-4f4f-bef6-a6b97315f438","publishedId":"2sA3sAhnX1","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2024-08-20T20:15:00.000Z"},"item":[{"name":"Events","item":[{"name":"Create event","id":"ed821b83-ef45-4574-8ec6-a90338bd3161","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"},{"key":"Authorization","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhlbGxvMTFAZ21haWwuY29tIiwiZXhwIjoxNzI0MjY3MzI3LCJ1c2VySWQiOjZ9.JHG4smP4kNyItZaWBoX4QMBno_6WT8N5NvGJso2dyug","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"name\":\"Bomb Event 2\",\n    \"description\":\"Make Bomb\",\n    \"location\":\"Hiroshima\"\n}","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":"http://localhost:8080/events","description":"<p>Create a new event.</p>\n","urlObject":{"path":["events"],"host":["http://localhost:8080"],"query":[],"variable":[]}},"response":[{"id":"e37a4685-a4d1-46d3-bdc7-c4445a8cb910","name":"Event created successfully","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"Postman Galaxy\",\n  \"date\": \"2021-02-2\",\n  \"time\": \"00:00:00\",\n  \"location\": \"Online\",\n  \"description\": \"Postman Galaxy API conference\"\n}","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":"http://localhost:8080/events"},"status":"Created","code":201,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"eventId\": \"abc-123\",\n    \"name\": \"Postman Galaxy\",\n    \"date\": \"2021-02-02\",\n    \"time\": \"00:00:00\",\n    \"location\": \"Online\",\n    \"description\": \"Postman Galaxy API conference\"\n}"}],"_postman_id":"ed821b83-ef45-4574-8ec6-a90338bd3161"},{"name":"List events","id":"2cc3efd0-7af0-4171-ad85-462a3bcf1ee4","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"http://localhost:8080/events","description":"<p>List all upcoming events.</p>\n","urlObject":{"path":["events"],"host":["http://localhost:8080"],"query":[],"variable":[]}},"response":[{"id":"b26f2560-2312-476b-9ed8-400529a63c80","name":"Events retrieved successfully","originalRequest":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"http://localhost:8080/events"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"[\n    {\n        \"eventId\": \"abc-123\",\n        \"name\": \"Postman Galaxy\",\n        \"date\": \"2021-02-2\",\n        \"time\": \"00:00:00\",\n        \"location\": \"Online\",\n        \"description\": \"Postman Galaxy API conference\"\n    },\n    {\n        \"eventId\": \"def-456\",\n        \"name\": \"FOSDEM 2023\",\n        \"date\": \"2023-02-04\",\n        \"time\": \"12:00:00\",\n        \"location\": \"Brussels\",\n        \"description\": \"A free event for software developers to meet, share ideas and collaborate.\"\n    }\n]"}],"_postman_id":"2cc3efd0-7af0-4171-ad85-462a3bcf1ee4"},{"name":"Get event details","id":"59d966ba-4e22-4c94-9b5b-4b52b2ead1e2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"http://localhost:8080/events/:eventId","description":"<p>View details of an event, including the number of registered attendees. For full attendee information, the \"List attendees\" endpoint can be used.</p>\n","urlObject":{"path":["events",":eventId"],"host":["http://localhost:8080"],"query":[],"variable":[{"type":"any","value":"2","key":"eventId"}]}},"response":[{"id":"befc4415-a266-456e-a559-eae0cb4fe9a6","name":"Event retrieved successfully","originalRequest":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":{"raw":"http://localhost:8080/events/:eventId","host":["http://localhost:8080"],"path":["events",":eventId"],"variable":[{"key":"eventId","value":"abc-123"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"eventId\": \"abc-123\",\n    \"name\": \"Postman Galaxy\",\n    \"date\": \"2021-02-2\",\n    \"time\": \"00:00:00\",\n    \"location\": \"Online\",\n    \"description\": \"Postman Galaxy API conference\",\n    \"attendees\": 127\n}"}],"_postman_id":"59d966ba-4e22-4c94-9b5b-4b52b2ead1e2"},{"name":"Update event","id":"8a884e79-4545-4799-90cc-77a22b5c9669","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"name\":\"Bomb Event 4\",\n    \"description\":\"Rebuild Bomb\",\n    \"location\":\"Nagasaki\"\n}","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":"http://localhost:8080/events/:eventId","description":"<p>Update the details of an existing event by ID.</p>\n","urlObject":{"path":["events",":eventId"],"host":["http://localhost:8080"],"query":[],"variable":[{"type":"any","value":"1","key":"eventId"}]}},"response":[{"id":"bb3da9c5-f4ae-461c-9993-1d1fc1a3abb9","name":"Event updated successfully","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"name\": \"Postman Galaxy\",\n    \"date\": \"2021-02-2\",\n    \"time\": \"12:34:56\",\n    \"location\": \"Online\",\n    \"description\": \"Postman Galaxy API conference\"\n}","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":{"raw":"http://localhost:8080/events/:eventId","host":["http://localhost:8080"],"path":["events",":eventId"],"variable":[{"key":"eventId","value":"abc-123"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n    \"eventId\": \"abc-123\",\n    \"name\": \"Postman Galaxy\",\n    \"date\": \"2021-02-2\",\n    \"time\": \"12:34:56\",\n    \"location\": \"Online\",\n    \"description\": \"Postman Galaxy API conference\"\n}"}],"_postman_id":"8a884e79-4545-4799-90cc-77a22b5c9669"},{"name":"Delete event","id":"00ff5007-349e-410a-98c6-0f171226e4be","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":"http://localhost:8080/events/:eventId","description":"<p>Delete an existing event.</p>\n","urlObject":{"path":["events",":eventId"],"host":["http://localhost:8080"],"query":[],"variable":[{"type":"any","value":"1","key":"eventId"}]}},"response":[{"id":"2068ec05-17d2-47ae-9b87-d953345b1ed7","name":"Event deleted successfully","originalRequest":{"method":"DELETE","header":[],"url":{"raw":"http://localhost:8080/events/:eventId","host":["http://localhost:8080"],"path":["events",":eventId"],"variable":[{"key":"eventId","value":null}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"eventId\": \"abc-123\",\n    \"name\": \"Postman Galaxy\"\n}"}],"_postman_id":"00ff5007-349e-410a-98c6-0f171226e4be"}],"id":"e00aaa4f-29e2-482a-b8b4-8a8f3fcf2712","description":"<p>This folder contains CRUD operations for events.</p>\n","_postman_id":"e00aaa4f-29e2-482a-b8b4-8a8f3fcf2712"},{"name":"User","item":[{"name":"SignUp User","id":"19467ef7-62e0-48ec-a9ff-be028b73998f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"username\":\"tejasvi22\",\r\n    \"email\":\"hello11@gmail.com\",\r\n    \"password\":\"12345678\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:8080/signup","urlObject":{"path":["signup"],"host":["http://localhost:8080"],"query":[],"variable":[]}},"response":[],"_postman_id":"19467ef7-62e0-48ec-a9ff-be028b73998f"},{"name":"Login","id":"f4f09a18-6876-4e74-ae57-6acfa6694e0d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"email\":\"hello11@gmail.com\",\r\n    \"password\":\"12345678\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:8080/login","urlObject":{"path":["login"],"host":["http://localhost:8080"],"query":[],"variable":[]}},"response":[],"_postman_id":"f4f09a18-6876-4e74-ae57-6acfa6694e0d"}],"id":"ab6d41e0-6709-440f-839d-1a1795711ee5","_postman_id":"ab6d41e0-6709-440f-839d-1a1795711ee5","description":""}],"event":[{"listen":"prerequest","script":{"id":"0eac71da-c99c-4802-aee9-5cc7a081c592","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"9bbb8e91-2ef2-4487-a245-32e688d7cebb","type":"text/javascript","exec":[""]}}],"variable":[{"key":"baseUrl","value":"http://localhost:8080"}]}