Skip to content

This repository offers a detailed template for establishing a server with Express, complete with all essential dependencies to guarantee a seamless development process. The template is structured to uphold the modular monolith architecture, fostering a tidy and sustainable code structure.

Notifications You must be signed in to change notification settings

perceptronbd/server-template

Repository files navigation

PUT IMAGE HERE

$\color{#FFE338}\textsf{\kern{0.2cm}\normalsize POSTMAN LINK}$

[Click Here]

Postman Environment Variable

Variable: base-url-v1,
Type: default,
initial_value:"localhost:5001/api/v1",
current_value:"localhost:5001/api/v1"
  1. Extract the Access Token:
  • In the Tests/Scripts tab of the super-admin/login,refresh request, add the following script to extract the access token from the response headers and save it to an environment variable:
// Extract the access token from the response headers
const accessToken = pm.response.headers.get("Authorization");

// Save the access token to an environment variable
pm.environment.set("accessToken", accessToken);
  1. Set the Access Token for Subsequent Requests:
  • For each subsequent request, go to the Headers tab and add a new header:
    • Key: Authorization
    • Value: {{accessToken}}
  • This will automatically use the access token stored in the environment variable for all subsequent requests.
  1. Remove AccessToken from Postman env
  • In the Tests/Scripts tab of the super-admin/logout request, add the following script to remove the access token from the environment variable:
// Check if the response status is 200 (OK)
if (pm.response.code === 200) {
  // Remove the access token from the environment variable
  pm.environment.unset("accessToken");
}

About

This repository offers a detailed template for establishing a server with Express, complete with all essential dependencies to guarantee a seamless development process. The template is structured to uphold the modular monolith architecture, fostering a tidy and sustainable code structure.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published