You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -46,6 +49,22 @@ If you found this project useful, then please consider giving it a ⭐️ on Git
46
49
47
50
you can change port in `.env` file check `.env-sample`
48
51
52
+
## Folder Structure
53
+
54
+
```
55
+
src
56
+
└───index.ts # Application entry point
57
+
└───routes.ts # Application routes / endpoints
58
+
└───controllers # Express route controllers for all the endpoints of the app
59
+
└───db # DB related files like connection / seed data
60
+
└───handlers # Common logic
61
+
└───logs # application logs
62
+
└───models # DB Models (Postgress)
63
+
└───repositories # All the database interaction logic is here
64
+
└───validators # API Request object validations
65
+
66
+
```
67
+
49
68
## Features
50
69
51
70
- CRUD operations for Courses
@@ -66,6 +85,32 @@ you can change port in `.env` file check `.env-sample`
66
85
-\[] Security
67
86
-\[] Hosting
68
87
88
+
## REST Services
89
+
90
+
The application exposes a few REST endpoints
91
+
92
+
`HTTP``GET` /api/lessons
93
+
`HTTP``GET` /api/lessons/:id
94
+
`HTTP``GET` /api/courses
95
+
You can use the following code snippet to call the secured endpoint:
96
+
97
+
```js
98
+
fetch("http://localhost:3000/api/courses", {
99
+
method:"GET",
100
+
headers: {
101
+
"Content-Type":"application/json",
102
+
},
103
+
})
104
+
.then((response) => {
105
+
if (response.status===200) {
106
+
response.json().then((j) =>console.log(j));
107
+
} else {
108
+
console.log("ERROR", response.status);
109
+
}
110
+
})
111
+
.catch((error) =>console.log(error));
112
+
```
113
+
69
114
## Contributing
70
115
71
116
Awesome! Contributions of all kinds are greatly appreciated. To help smoothen the process we have a few non-exhaustive guidelines to follow which should get you going in no time.
0 commit comments