REST API to find The Most Awesomest Movies
Search movies, manage 'em too
Built with node v20.3 and TypeScript 5.1, using Express framework. Storing data in MongoDB, testing with Jest.
git clone https://github.com/Peukku/movieapi.git
cd movieapi
npm install
Configure:
Set port (default 3000), and mongodb connection info in .env.local
Load fixtures and start the server
npm run load-fixtures
npm run start-dev
(NOTE: Loading fixtures clears the Database!)
# GET all movies:
curl http://127.0.0.1:3000/api/movies -v -X GET
# GET filtered list of movies:
curl http://127.0.0.1:3000/api/movies?q=avengers -v -X GET
# GET details of movie with id
curl http://127.0.0.1:3000/api/movies/648f8ab990b0f007b859b6b1 -v -X GET
# DELETE movie with id
curl http://127.0.0.1:3000/api/movies/648f8ab990b0f007b859b6b1 -v -X DELETE
# POST new movie;
curl http://127.0.0.1:3000/api/movies -v -d "name=The Super Mario Bros. Movie&year=2023"
- Project Setup
- Simple Movie model
- Add details to Movie model
- Add data importer
- GET list of all movies
- GET details of specific movie
- POST new movie
- Add error handling
- DELETE movie
- Simple test case
- Fix dotenv-flow for test (.env.local ignored)
- Handle persons (actors, directors) properly
- PUT / PATCH movie
- Fix response statuses
- Add user model
- Allow POST / PUT / PATCH / DELETE only to authenticated
- Validate POST / PUT / PATCH parameters
- Document API (OPENAPI definition)
- Add pagination, sorting
- Add more filtering options (now indexed text search only for name and synopsis)
- ...
- Add tests
- Add eslint
- Add docker-compose for local Mongo
- Switch to ORM, Prisma?