Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"env": {
"commonjs": true,
"es2021": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 12
},
"rules": {
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
.vscode
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# Assignment-1

In this Assignment You need to code your own server using ExpressJS.

Fork, Clone, Work, Commit Push and Create a Pull Request when you finish.

These are some of the resources that you might need:

+ [Swagger](https://editor.swagger.io/)
+ [Mongoose](https://mongoosejs.com/)
+ [ExpressJS](https://expressjs.com/)
+ [Express](https://dev.to/pacheco/designing-a-better-architecture-for-a-node-js-api-24d) [Architectural](https://blog.logrocket.com/the-perfect-architecture-flow-for-your-next-node-js-project/) and [Design Patterns](https://scoutapm.com/blog/nodejs-architecture-and-12-best-practices-for-nodejs-development)
+ [MySQL Integration](https://github.com/sidorares/node-mysql2#readme)
+ [Sequelize ORM](https://sequelize.org/)
+ [Error Middlewares](https://dev.to/nedsoft/central-error-handling-in-express-3aej)
- [Swagger](https://editor.swagger.io/)
- [Mongoose](https://mongoosejs.com/)
- [ExpressJS](https://expressjs.com/)
- [Express](https://dev.to/pacheco/designing-a-better-architecture-for-a-node-js-api-24d) [Architectural](https://blog.logrocket.com/the-perfect-architecture-flow-for-your-next-node-js-project/) and [Design Patterns](https://scoutapm.com/blog/nodejs-architecture-and-12-best-practices-for-nodejs-development)
- [MySQL Integration](https://github.com/sidorares/node-mysql2#readme)
- [Sequelize ORM](https://sequelize.org/)
- [Error Middlewares](https://dev.to/nedsoft/central-error-handling-in-express-3aej)

Once you Finish Submit the link of your pull Request On Moodle

Expand Down
121 changes: 60 additions & 61 deletions api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,36 @@ info:
host: "localhost:3000"
basePath: "/api"
tags:
- name: "Auth"
description: "Everything about Authentication"
- name: "Lists"
description: "Access to Storify Lists"
- name: "Items"
description: "Operations about Items"
- name: "Categories"
description: "Operations about Items"
- name: "Auth"
description: "Everything about Authentication"
- name: "Lists"
description: "Access to Storify Lists"
- name: "Items"
description: "Operations about Items"
- name: "Categories"
description: "Operations about Items"
schemes:
- "https"
- "http"
- "https"
- "http"
paths:
/login:
post:
tags:
- "Auth"
- "Auth"
summary: "Authenticate a user to your Platform"
description: ""
operationId: "login"
consumes:
- "application/json"
- "application/json"
produces:
- "application/json"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "User Credentials"
required: true
schema:
$ref: "#/definitions/LoginRequest"
- in: "body"
name: "body"
description: "User Credentials"
required: true
schema:
$ref: "#/definitions/LoginRequest"
responses:
201:
description: "successful operation"
Expand All @@ -56,13 +56,13 @@ paths:
/signup:
post:
tags:
- "Auth"
- "Auth"
summary: "Registering a User"
operationId: "signup"
consumes:
- "application/json"
- "application/json"
produces:
- "application/json"
- "application/json"
parameters:
- in: "body"
name: "body"
Expand All @@ -81,22 +81,22 @@ paths:
get:
operationId: "getUser"
summary: "Get the connected user informations"
tags:
- "Auth"
tags:
- "Auth"
responses:
200:
description: "Success"
schema:
$ref: "#/definitions/User"
$ref: "#/definitions/User"
401:
$ref: "#/responses/401"
404:
$ref: "#/responses/404"
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []

/lists:
get:
summary: "Fetch all the connected user lists"
Expand All @@ -115,8 +115,8 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []

post:
summary: "Create a list for the connected user"
operationId: "createList"
Expand Down Expand Up @@ -150,7 +150,7 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []
/lists/{list_id}:
put:
operationId: "updateList"
Expand Down Expand Up @@ -191,7 +191,7 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []
delete:
summary: "Delete a list for the connected user"
tags:
Expand All @@ -216,8 +216,8 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []

/lists/{list_id}/items:
get:
summary: "Fetch all the connected user items of a certain list"
Expand All @@ -240,14 +240,14 @@ paths:
description: "Success"
schema:
type: "array"
items:
items:
$ref: "#/definitions/Item"
401:
$ref: "#/responses/401"
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []
post:
summary: "Add an Item to a specific list for the user"
operationId: "createItemInList"
Expand Down Expand Up @@ -289,7 +289,7 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []
put:
summary: "Update an Item of a specific list for the user"
operationId: "updateItemOfList"
Expand Down Expand Up @@ -339,7 +339,7 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []
delete:
summary: "Delete an Item of a specific list for the user"
operationId: "DeleteItemOfList"
Expand All @@ -365,8 +365,8 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []

/items:
get:
summary: "Fetch all the connected user items"
Expand All @@ -387,8 +387,8 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []

post:
summary: "Create an Item for the connected user"
operationId: "createItem"
Expand Down Expand Up @@ -430,7 +430,7 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []
/items/{item_id}:
put:
summary: "Update an Item of a user"
Expand Down Expand Up @@ -479,7 +479,7 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []
delete:
summary: "Delete an Item of a user"
operationId: "DeleteItem"
Expand All @@ -505,7 +505,7 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []
/categories:
get:
summary: "Fetch all the connected user categories"
Expand All @@ -526,8 +526,8 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []

post:
summary: "Create a Category for the connected user"
operationId: "crateCategory"
Expand Down Expand Up @@ -560,7 +560,7 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []
/categories/{category_id}:
put:
summary: "Update a Category of a user"
Expand Down Expand Up @@ -600,7 +600,7 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []
delete:
summary: "Delete a Category of a user"
operationId: "deleteCategory"
Expand All @@ -626,12 +626,12 @@ paths:
500:
$ref: "#/responses/500"
security:
- basicAuth: []
- basicAuth: []

securityDefinitions:
basicAuth:
type: basic

responses:
400:
description: Bad Request
Expand Down Expand Up @@ -667,13 +667,13 @@ definitions:
type: "object"
properties:
user:
type: "object"
example:
$ref: "#/definitions/User"
type: "object"
example:
$ref: "#/definitions/User"
token:
type: "string"
example: "qlkjyzqsd325.!qspuezappz"

User:
type: "object"
properties:
Expand All @@ -686,7 +686,7 @@ definitions:
userName:
type: "string"
example: "Username123"

List:
type: "object"
properties:
Expand All @@ -700,12 +700,12 @@ definitions:
type: "string"
updated_at:
type: "string"

ListArray:
type: "array"
items:
$ref: "#/definitions/List"

Item:
type: "object"
properties:
Expand All @@ -725,7 +725,7 @@ definitions:
type: "string"
updated_at:
type: "string"

Category:
type: "object"
properties:
Expand All @@ -744,7 +744,7 @@ definitions:
updated_at:
type: "string"
example: "2020-09-02T14:48:41.919Z"

Error:
type: "object"
properties:
Expand All @@ -764,4 +764,3 @@ definitions:
type: "string"
message:
type: "string"

Loading