Commit Graph

  • 0262be65ef Sending background emails. master Maxime Delporte 2025-12-04 14:12:55 +01:00
  • 8954318e40 Adding godotenv library to use our .env file for the smtp configuration. Updating main.go adding our logger first, load our .env file, retrieve values to initialize the mail application's struct. Updating registerUserHandler sending the user_welcome.tmpl email. Maxime Delporte 2025-11-30 17:22:32 +01:00
  • 68e606976f Adding go-mail package instead of using internal go package. Defining a mailer package to send our emails. Maxime Delporte 2025-11-30 17:02:48 +01:00
  • 72503a55ff Creating registerUserHandler and registering the endpoint in our routes.go Maxime Delporte 2025-11-25 15:54:43 +01:00
  • 2bd0ae90bc Adding Insert(), GetByEmail(), Update() UserModel's methods. Maxime Delporte 2025-11-25 13:44:54 +01:00
  • 5a4b7bceb0 Adding crypto package to hash user's password on our User Model. Create our User Model with some helpers. Creating migration for our users table. Maxime Delporte 2025-11-25 11:35:24 +01:00
  • 6b4056e0f5 Handling graceful shutdown. Maxime Delporte 2025-11-23 16:59:02 +01:00
  • b04086f9da Adding goroutine to intercept SIGINT and SIGTERM signals to properly shutdown the app. Maxime Delporte 2025-11-23 16:00:58 +01:00
  • 78d9edf62b Moving starting server part into new server.go file. Using the new serve() function from this file into main.go Maxime Delporte 2025-11-23 15:54:32 +01:00
  • f88edf082e Adding 'Sending Shutdown Signals' section. Maxime Delporte 2025-11-19 14:39:15 +01:00
  • 83bb7294db Configuring the Rate Limiters. Maxime Delporte 2025-11-18 20:10:55 +01:00
  • 7de9ef89b7 Adding 'Addictional Information for Rate Limiting' sub section. Maxime Delporte 2025-11-16 19:35:28 +01:00
  • 116cdb099f Updating rateLimit middleware with IP-based Rate Limiting Maxime Delporte 2025-11-16 10:48:55 +01:00
  • 5517aa29f9 Adding 'IP-based Rate Limiting' sub section. Maxime Delporte 2025-11-16 10:37:09 +01:00
  • 8b0c51123f Enforcing a global rate limit. Maxime Delporte 2025-11-16 10:36:36 +01:00
  • e93375d441 Returning pagination metadata. Maxime Delporte 2025-11-15 16:51:13 +01:00
  • 28b25fed6e Returning empty array instead of null if we don't have any movies to return. Maxime Delporte 2025-11-15 16:37:08 +01:00
  • 6fc5e725e6 Paginating Lists Maxime Delporte 2025-11-15 16:34:40 +01:00
  • fc2e401f6f Adding sorting lists. Maxime Delporte 2025-11-14 17:31:29 +01:00
  • 6b3a6ee4f5 Adding indexes migration. Maxime Delporte 2025-11-14 16:46:21 +01:00
  • a17a49e814 Adding 'Indexes' sub section. Maxime Delporte 2025-11-13 18:57:24 +01:00
  • 0d1062d995 Adding full-text search. Maxime Delporte 2025-11-13 18:52:59 +01:00
  • 1b71a1a8ad Creating GetAll MovieModel method to retrieve all movies. Updating the listMovieHandler to use the new GetAll MovieModel's method. Maxime Delporte 2025-11-13 15:25:00 +01:00
  • 95d9de60b4 Adding ValidateFilters method in filters.go and use it in our listMoviesHandler Maxime Delporte 2025-11-12 11:09:57 +01:00
  • bf7c53e565 Creating Filters struct and using it inside our listMoviesHandler Maxime Delporte 2025-11-11 10:47:25 +01:00
  • 041d302a79 Creating listMoviesHandler and adding /v1/movies GET endpoint to use it. Maxime Delporte 2025-11-11 10:43:34 +01:00
  • b77d3adb55 Adding readString, readInt and readCSV helper functions Maxime Delporte 2025-11-11 10:29:15 +01:00
  • 0ba997475b Updating database model with 3-second timeout deadline for all our operations. Maxime Delporte 2025-11-10 17:00:06 +01:00
  • 5413312875 Adding a query timeout. Maxime Delporte 2025-11-10 16:45:42 +01:00
  • fd3bca1226 Adding a check on the X-Expected-Version header field. Maxime Delporte 2025-11-10 10:21:14 +01:00
  • f8f78c3eec Adding concurrency control in our updateMovieHandler and documenting it. Maxime Delporte 2025-11-08 10:41:44 +01:00
  • b76496e096 Updating updateMovieHandler to be able to update only some fields (patch instead of put). Update routes with the correct verb. Maxime Delporte 2025-11-07 11:57:04 +01:00
  • 1270a3bda6 Updating MovieModel's Delete method from internal/data/movies.go file. Create the deleteMovieHandler function inside cmd/api/movies.go. Adding the route into routes.go to delete a movie. Maxime Delporte 2025-11-07 11:37:19 +01:00
  • 69651c58b7 Updating MovieModel's method from internal/data/movies.go file. Create the updateMovieHandler function inside cmd/api/movies.go. Adding the route into routes.go to update a movie. Maxime Delporte 2025-11-07 11:27:45 +01:00
  • 490c3174ca Adding 'Why not use an unsigned integer for the movie ID?' sub-section. Maxime Delporte 2025-11-07 11:06:35 +01:00
  • 0824a127b9 Updating internal/data/movies.go to Get a movie from the database. Updating cmd/api/movies.go showMovieHandler method to fetch a movie from a request (using the MovieModel's Get method). Maxime Delporte 2025-11-07 10:58:58 +01:00
  • 0653a46101 Adding ' notation' and 'Executing multiple statements' sub-sections. Maxime Delporte 2025-11-07 10:47:15 +01:00
  • 19a844ea2e Updating Insert MovieModel's method inserting a new record in the movies table. Updating createMovieHandler to use Insert MovieModel's method. Maxime Delporte 2025-11-06 17:10:33 +01:00
  • 1a658d3063 Updating movies.go with MovieModel: this struct is the gateway between our app and the database. Adding CRUD methods alongside for the Movie object. Creating models.go: this file holds a Models struct wrapping all of our Models. This way, we are able to use in our application struct in our main.go. Maxime Delporte 2025-11-06 10:41:12 +01:00
  • 0874a6aac4 Adding 'Remote migration files' sub-section. Maxime Delporte 2025-11-06 10:17:12 +01:00
  • 6997490335 Adding 'Fixing errors in SQL migrations' sub-section. Maxime Delporte 2025-11-06 10:14:02 +01:00
  • ece88f7e71 Creating 'Migrating to a specific version' and 'Executing down migrations' sub sections. Maxime Delporte 2025-11-03 17:57:51 +01:00
  • 4b42c5edfc Updating 'Executing the migrations' sub-section. Maxime Delporte 2025-11-03 17:39:46 +01:00
  • a5025cd98e Updating CI. Maxime Delporte 2025-10-31 12:12:57 +01:00
  • 72508f9bdb Fix typo. Maxime Delporte 2025-10-31 12:07:27 +01:00
  • 10ea699625 Adding 'Executing the migrations' subsection into README.md. Adding log messages on deploy.yml. Maxime Delporte 2025-10-31 12:05:53 +01:00
  • 80800b214c Updating CI. Maxime Delporte 2025-10-31 10:49:50 +01:00
  • ab17b9f8f1 Updating CI. Maxime Delporte 2025-10-31 10:48:34 +01:00
  • 8f047f2b4a Updating CI. Maxime Delporte 2025-10-31 10:46:18 +01:00
  • 17a69b32be Updating CI. Maxime Delporte 2025-10-31 10:42:17 +01:00
  • eb0a0bb221 Updating CI. Maxime Delporte 2025-10-31 10:40:08 +01:00
  • 3476d82ada Updating CI. Maxime Delporte 2025-10-31 10:35:33 +01:00
  • 9fdd6c117f Updating CI. Maxime Delporte 2025-10-31 10:33:07 +01:00
  • 1c7977fd73 Updating CI. Maxime Delporte 2025-10-31 10:30:30 +01:00
  • 42461ef8fb Updating CI. Maxime Delporte 2025-10-31 10:18:37 +01:00
  • 4f31716a22 Updating CI. Maxime Delporte 2025-10-31 10:17:20 +01:00
  • 0229af2932 Updating CI. Maxime Delporte 2025-10-31 10:14:05 +01:00
  • e639e44d72 Updating CI. Maxime Delporte 2025-10-30 15:36:45 +01:00
  • 6e4b4c6ca4 Updating CI. Maxime Delporte 2025-10-30 15:35:21 +01:00
  • dd259e608e Updating CI. Maxime Delporte 2025-10-30 15:33:57 +01:00
  • 93a328c0ef Updating CI. Maxime Delporte 2025-10-30 15:32:05 +01:00
  • 4c9d604733 Updating CI. Maxime Delporte 2025-10-30 15:28:29 +01:00
  • 6198a930ee Updating CI. Maxime Delporte 2025-10-30 15:27:11 +01:00
  • f96baad6a8 Updating CI. Maxime Delporte 2025-10-30 15:22:42 +01:00
  • 641f430fd4 Creating migrations files to create movies table and add movies check constraints. Updating API version number. Updating README.md adding 'SQL Migrations' section. Updating deployment file to make migrations before building API. Adding some .idea files into .gitignore. Maxime Delporte 2025-10-30 15:16:20 +01:00
  • f72ad2aa2f Updating README.md adding 'Configuring the Database Connection Pool'. Updating main.go configurating the database connection pool with maxOpenConns, maxIdleConns and maxIdleTime values. Maxime Delporte 2025-10-30 12:13:55 +01:00
  • 8cdf3c7ada Adding 'github.com/lib/pq' library to use our PostgreSQL database. Updating our main.go file to establish a connection with the database pool. Maxime Delporte 2025-10-28 17:02:36 +01:00
  • 84741de60e Adding 'Optimizing PostgreSQL settings' sub-section. Maxime Delporte 2025-10-28 16:29:42 +01:00
  • 13d670c9a5 Adding .gitignore to prevent useless or private files to be pushed. Maxime Delporte 2025-10-28 16:03:45 +01:00
  • 6ef731573b Exporting the validation from cmd/api/movies.go to internal/data/movies.go by creating the ValidateMovie method. Updating createMovieHandler to use our new ValidateMovie method. Maxime Delporte 2025-10-28 12:07:04 +01:00
  • e5ddfa120f Creating validator.go allowing us to validate received data from our endpoints. Updating errors.go adding failedValidationResponse method allowing us to deliver a StatusUnprocessableEntity error. Updating createMovieHandler with the use of our new validator package. Maxime Delporte 2025-10-28 11:04:18 +01:00
  • 040ace30ad Updating createMovieHandler accepting data.Runtime for the Runtime field. Updating internal/data/runtime.go with the json.Unmarshaler interface to transform our client's runtime string field '%d mins' into a Runtime type format. Maxime Delporte 2025-10-27 20:03:52 +01:00
  • 599ab6b3c6 Prevent client to send more than one JSON's object. Prevent client to send unknown fields. Prevent client to send more than 1MB of data per endpoint, preventing DDOS attacks. Maxime Delporte 2025-10-27 19:45:37 +01:00
  • c3fdb40ae4 Adding more context for invalidUnmarshalError management inside readJSON function. Updating 'Panicking vs returning errors' section. Maxime Delporte 2025-10-25 09:57:41 +02:00
  • 6d09a4f545 Adding 'Panicking vs returning errors' section Maxime Delporte 2025-10-25 09:52:57 +02:00
  • 906bd868f9 Creating badRequestResponse helper method inside errors.go and use in in the createMovieHandler. Maxime Delporte 2025-10-24 18:55:05 +02:00
  • 12e1c7a523 Updating createMovieHandler using helper's readJSON method. Maxime Delporte 2025-10-24 14:47:20 +02:00
  • c6baa807e4 Creating readJSON method to manage errors that can happen once. Maxime Delporte 2025-10-24 14:27:46 +02:00
  • b3502631c2 Creating 'Supported destinations types' and 'Triaging the Decode error' sections. Maxime Delporte 2025-10-24 14:27:06 +02:00
  • d650691b08 Updating createMovieHandler decoding received data from client. Maxime Delporte 2025-10-24 14:02:36 +02:00
  • e30eac9c4d Updating README.md adding 'System-generated error responses' and 'Panic recovery in other goroutines' sections. Maxime Delporte 2025-10-23 17:16:25 +02:00
  • 7057f89038 Creating recoverPanic method inside our middleware.go file and use it inside routes.go wrapping our router. Maxime Delporte 2025-10-23 14:19:53 +02:00
  • 2124f2f882 Using the new error's helper methods inside our current API endpoint and with our httprouter Handlers NotFound and MethodNotAllowed (will override the default responses with our helper's methods) Maxime Delporte 2025-10-21 19:02:42 +02:00
  • 0f7515e198 Removing string json's parameter from Runtime variable inside Movie's struct. Creating errors.go handling different json's error for our API. Maxime Delporte 2025-10-21 18:55:45 +02:00
  • bc21c4cf87 Use Runtime type instead of int32 in our Movie struct. Maxime Delporte 2025-10-21 16:29:11 +02:00
  • cc588a1dc0 Adding 'Advanced JSON Customization' section in the README.md. Creating a runtime type (internal/data/runtime.go) to show how we can customize a JSON field. Maxime Delporte 2025-10-21 16:26:06 +02:00
  • e7944c3117 Fixing CI. Maxime Delporte 2025-10-20 18:28:35 +02:00
  • b253d7ada3 Fixing CI. Maxime Delporte 2025-10-20 15:57:18 +02:00
  • 85cb67de34 Fixing CI Maxime Delporte 2025-10-20 15:54:37 +02:00
  • 5d93100758 Fixing CI Maxime Delporte 2025-10-20 15:49:55 +02:00
  • 221d2c45df Fixing CI Maxime Delporte 2025-10-20 15:47:30 +02:00
  • 67656bdcc9 Fixing CI Maxime Delporte 2025-10-20 15:45:23 +02:00
  • c17f0d6909 Fixing CI Maxime Delporte 2025-10-20 15:35:16 +02:00
  • c7828fe5d7 Fixing CI. Maxime Delporte 2025-10-20 15:33:53 +02:00
  • f282e7943a Fixing CI. Maxime Delporte 2025-10-20 15:27:48 +02:00
  • 650c7fa894 Fixing CI. Maxime Delporte 2025-10-20 14:49:28 +02:00
  • d482d5afb7 Fixing CI. Maxime Delporte 2025-10-20 14:40:21 +02:00
  • 0df71deae7 Creating deploy.yml for CI/CD. Maxime Delporte 2025-10-20 14:35:05 +02:00
  • 5ca50c6566 Fixing typo. Maxime Delporte 2025-10-19 18:08:58 +02:00
  • 43612c90e0 Updating README typo. Maxime Delporte 2025-10-19 11:50:17 +02:00