REST API using Express provide a way for users to administer, _creating an account and _log-in, a school database containing information about courses: users can interact with the database by retrieving a list of courses, as well as _adding, _updating and _deleting courses in the database.
Created with node.js, express and SQL ORM Sequelize using middleware for error handlling, authentication and field validations, routes and SQLite database:
- GET /api/courses Non authenticated route to get a list of all courses with respective user owner.
- GET /api/courses/1 Non authenticated route to get a course with specific id.
- POST /api/user Non authenticated route to post/create new user. Returning location header to root.
- GET /api/users Authenticated route to get user info (no password)
- POST /api/courses Authenticated route to post/create new course. Returning location header with course uri.
- PUT _/api/courses/:id Authenticated route to put/update a course with specific id
- DELETE _/api/courses/:id Authenticated route to delete a course with a specific id
Every route has its error response where a problem ocurres because empty fields (or invalid format email), non existing course, authentication problem with wrong user/password/don't own course to modify or not found route.