Each page which needs for authentication or request is done by simply calling any related function from ./api/.
 Ex. getting item on front page: Each

krehwell / HeckarNews

submited by
Style Pass
2021-06-17 21:00:05

Each page which needs for authentication or request is done by simply calling any related function from ./api/. Ex. getting item on front page:

Each function on ./api/ is already map with ./utils/apiBaseUrl.js. So, no need to bother about API URL code when running on development or production. Just change the url on ./next.config.js for each development environment.

All styles is using pure CSS which can be found at ./styles/. The directory structure for styles is more or less map to be similar like ./pages/ for ease of use while the importing of all styles is done in ./pages/_app.js.

In each of it, there is api.js and index.js which work by each request type in index.js (GET, POST, etc.) will call API functions from api.js for it to process between Db and return result back to index.js to be a response later. (./routes/search/ only has api.js since it does not have any route definition)

The purpose of index.js is for routes definition, accept request, call api.js to process, and return response to client. Take an example of ./routes/user/index.js for login workflow:

Leave a Comment
Related Posts