{"id":15170680,"url":"https://github.com/douglasmoraisdev/node_movie_rental_api","last_synced_at":"2026-02-04T06:04:27.997Z","repository":{"id":211454167,"uuid":"159717432","full_name":"douglasmoraisdev/node_movie_rental_api","owner":"douglasmoraisdev","description":"A simple Movie Rental API with Node and Express.js","archived":false,"fork":false,"pushed_at":"2018-12-05T12:24:24.000Z","size":165,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-10T05:16:39.760Z","etag":null,"topics":["chaijs","expressjs","mochajs","node","nodejs","oauth2","sequelizejs","tdd"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/douglasmoraisdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-11-29T19:33:21.000Z","updated_at":"2018-12-13T17:21:16.000Z","dependencies_parsed_at":"2023-12-08T16:50:52.973Z","dependency_job_id":null,"html_url":"https://github.com/douglasmoraisdev/node_movie_rental_api","commit_stats":null,"previous_names":["douglasmoraisdev/node_movie_rental_api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/douglasmoraisdev/node_movie_rental_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasmoraisdev%2Fnode_movie_rental_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasmoraisdev%2Fnode_movie_rental_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasmoraisdev%2Fnode_movie_rental_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasmoraisdev%2Fnode_movie_rental_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/douglasmoraisdev","download_url":"https://codeload.github.com/douglasmoraisdev/node_movie_rental_api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasmoraisdev%2Fnode_movie_rental_api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29072481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T03:31:03.593Z","status":"ssl_error","status_checked_at":"2026-02-04T03:29:50.742Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chaijs","expressjs","mochajs","node","nodejs","oauth2","sequelizejs","tdd"],"created_at":"2024-09-27T08:21:20.672Z","updated_at":"2026-02-04T06:04:27.983Z","avatar_url":"https://github.com/douglasmoraisdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node_movie_rental_api\nA simple Movie Rental API with Node and Express.js\n\n\n## Table of Contents\n\n1. [Description](#Description)\n2. [Running](#Running)\n3. [Database Migration](#database-migration)\n4. [Test](#Test)\n4. [API EndPoints Description](#API-EndPoints-Description)\n\n---\n\n## Description\nA REST API for a Movie Rental Business:\n\n* Show all available Movies to Rent.\n* Each Movie (Movie Title), may have many copies (Movie Copy)\n* A User can register\n* A User can do Login/Logout using a Auth Token\n* A User can Rent one or many Movie Copies available\n* A User just can Rent Available Movies (a Movie Copy not Rented)\n* A User can Return a Movie Copy rented using a movie_copy_id\n* For list, rent and return movies, a User should be authenticated\n\n## Running\n\n* 1 - Update packages\n  \n  ```\n  $ npm install\n  ```\n\n* 2 - Start Server\n  ```\n    $ npm start\n  ```\n\n\n* 3 - Server available on:\n\u003ehttp://localhost:3000\n\n## Database Migration\n\n* 1 - Go to the database path\n  ```\n  $ cd movie_rental/db/\n  ```\n\n\n* 2 - Delete migration lock (if exists)\n  ```\n  $ rm sequelize-meta.json\n  ```\n\n\n* 3 - Create a alias for Sequelize CLI (Optional)\n  ```\n  $ alias sequelize='../node_modules/.bin/sequelize'\n  ```\n\n\n* 4 - Run migration\n  ```\n  $ sequelize db:migrate\n  ```\n\n\n* 5 - Populate database\n  ```\n  $ sequelize db:seed:all\n  ```\n\n\n\n## Test\n\n* Run tests\n  ```\n  $ npm test\n  ```\n\n## API EndPoints Description\n\nNote: All endpoints (except /users/register and /users/authenticate) must be authenticated using User Token on the Authorization Header!\n\n\nCURL example:\n  ```\n $ curl -X GET http://localhost:3000/movies/available -H 'authorization: Bearer 4user.generated.tok3n'\n  ``` \n\n### User Routes\n\n\u003ePOST /users/authenticate\n\u003e\nAuthenticate a user, return the Auth Token\n* body params(JSON format) :\n  * username (The user email)\n  * password (User password)\n\n* returns:  \n    * token (Use it on Authorization Header Bearer)\n\n\n\u003ePOST /users/register\n\u003e\nRegister a new user\n* body params(JSON format):\n  * username (The user email)\n  * password (User password)\n  * firstName (User First Name)\n  * lastName (User Last Name)\n\n* returns:  \n    * token (Use it on Authorization Header Bearer)\n\n\n### Movies Routes\n\n\u003eGET /movies/available\n\u003e\nShow a list of all available Movies for Rent and its quantity.\n* returns:  \n    * id (Available Movie Title id. Use it for Rent a movie)\n    * title (Movie title name)\n    * availables (available quantity)\n\n\u003ePOST /movies/rent/\u003cmovie_id\u003e\n\u003e\nRent a Movie for a User. Get the first available Copy of a Movie, register the rent and returns the Movie Copy Info rented.\n* url params:\n    * movie_id (ID of a available Movie Title)\n* returns:  \n    * rent\n        * id (id of the Rent)\n        * movieCopy_ID (id of a Movie Copy. Use it for return the Movie)\n        * User_ID (id of the User),\n        * rentalDate (Rent timestamp),\n\n\u003ePUT /movies/return/\u003cmovie_copy_id\u003e\n\u003e\nReturns a Movie for a User.\n* url params:\n    * movie_copy_id (ID of a Movie Copy for return)\n* returns:  \n    * msg: (Status messagem)\n    * success: (Success Status)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdouglasmoraisdev%2Fnode_movie_rental_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdouglasmoraisdev%2Fnode_movie_rental_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdouglasmoraisdev%2Fnode_movie_rental_api/lists"}