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
{{ message }}
Repository navigation
Commit ddf7842
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,6 +76,8 @@ To get started with this project, follow the steps below.
76
76
77
77
### Configuration
78
78
79
+
#### Environment file
80
+
79
81
Create a **.env** file in the project root directory to store your environment variables. This is essential for configuring database connections and other settings.
80
82
81
83
Example .env file:
@@ -86,6 +88,24 @@ DB_PASS=my_password
86
88
DB_NAME=db_php_restful_api
87
89
```
88
90
91
+
#### Error Log
92
+
93
+
Create an **error.log** file in the logs directory to store all error logs that occur when the application runs.
94
+
95
+
```
96
+
(root)
97
+
├───config
98
+
├───logs
99
+
│ └───error.log # This is new file to log the error
100
+
├───public
101
+
├───src
102
+
│ ├───controllers
103
+
│ ├───models
104
+
│ └───routes
105
+
└───vendor
106
+
```
107
+
108
+
89
109
## Usage
90
110
91
111
After setting up the project, you can access the API endpoints using a tool like Postman or cURL. Below are some examples of how to use the endpoints:
The API includes custom error handling to manage different scenarios, such as:
121
143
122
144
- 404 Not Found: When a user is not found.
@@ -125,5 +147,9 @@ The API includes custom error handling to manage different scenarios, such as:
125
147
126
148
All responses are returned in JSON format, providing a consistent structure for success and error messages.
127
149
150
+
### Error Log
151
+
All server errors are logged to a file located at **logs/error.log**. This log file can be used to monitor your web application when it is live in production, helping to identify and troubleshoot issues effectively.
152
+
153
+
128
154
## License
129
155
This project is open-source and available under the MIT License. Feel free to modify and use it as a learning resource.
0 commit comments