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
By default, the server runs on `http://localhost:3001`.
26
+
By default, the server runs on `http://localhost:3000`.
27
27
28
28
### API Structure
29
29
30
-
Place your JSON files inside the api folder. The folder structure determines the API routes.
30
+
Place your JSON files inside the `api` folder. The folder structure determines the API routes.
31
31
32
32
For example, given the following structure:
33
33
34
34
```sh
35
35
api/
36
-
users/
37
-
list.json
38
-
details.jsonYou can access:
36
+
posts.json --> http://localhost/api/posts
37
+
users.json --> http://localhost/api/users
38
+
users/
39
+
2.json --> http://localhost/api/users/2
39
40
```
40
41
41
42
You can access:
42
43
43
-
- GET /api/users/list → Returns list.json
44
-
- GET /api/users/details → Returns details.json
44
+
- GET /api/posts → Returns posts.json
45
+
- GET /api/users → Returns users.json
46
+
- GET /api/users/2 → Returns 2.json
45
47
46
48
### Middleware
47
49
48
50
The application includes:
49
51
50
52
* Logging: Logs incoming requests
51
-
* Security Headers: Adds basic security headers
52
53
* Compression: Enables Gzip compression
53
54
* Static File Serving: Serves files from the public folder
54
55
## Configuration
55
-
Set PORT in the environment variables to change the server port.
56
+
By default, the server runs on port `80` and port `3000` in the development stage. To change the port, set the PORT environment variable in `package.json`.
0 commit comments