https://github.com/cm-iv/library-api
CRUD API written in Typescript with the AdonisJS framework.
https://github.com/cm-iv/library-api
Last synced: 3 months ago
JSON representation
CRUD API written in Typescript with the AdonisJS framework.
- Host: GitHub
- URL: https://github.com/cm-iv/library-api
- Owner: CM-IV
- Created: 2021-12-21T07:11:30.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-28T04:11:36.000Z (over 3 years ago)
- Last Synced: 2025-01-22T00:15:53.207Z (5 months ago)
- Language: TypeScript
- Size: 283 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Library / Website Showcase API
CRUD API written in Typescript with the AdonisJS framework.**Here is a snippet of the API router code:**
```
Route.group(() => {
Route.group(() => {
//post /books
//put /books/:id
//delete /books/:id
Route.resource("/books", "BooksController").only([
"store",
"update",
"destroy",
]);//post /previews
//put /previews/:id
//delete /previews/:id
Route.resource("/previews", "PreviewsController").only([
"store",
"update",
"destroy",
]);//logout
Route.post("/logout", "AuthController.logout");
}).middleware("auth");//get /books list
//get /books/:id
Route.resource("/books", "BooksController").only(["show", "index"]);
//get /previews list
//get /previews/:id
Route.resource("/previews", "PreviewsController").only(["show", "index"]);
//register and login controllers
Route.post("/register", "AuthController.register");
Route.post("/login", "AuthController.login");
}).prefix("/api");
```This is a CRUD API with full Create, Read, Update, and Delete functionality.
AdonisJS Auth is used for Authentication functionality.