π Requirements β’
π Usage β’
π£οΈ Endpoints β’
π Script β’
π Visualization β’
- Node.js
- Express.js
- Clone the repository:
git clone https://github.com/ronknight/app-js.git
- Install dependencies:
npm install
- Run the server:
node app.js
- The server will start running on
http://localhost:80
-
π / (GET)
- Saves the
code
andstate
query parameters - Returns a blank HTML page
- Saves the
-
π /get-saved-name (GET)
- Retrieves the saved
code
andstate
parameters - Returns a JSON object with the saved values
- Retrieves the saved
The app.js
script sets up an Express.js server that:
- πΎ Saves
code
andstate
query parameters from the root endpoint - π Stores these values in memory
- π Provides an endpoint to retrieve the saved values
Here's a flow chart that visualizes the structure and flow of the application:
graph TD
A[Start Server] -->|Listen on PORT 80| B[Initialize Variables]
B --> C{Receive Request}
C -->|GET '/'| D[Save Query Parameters]
D --> E[Return Blank HTML]
C -->|GET '/get-saved-name'| F{Saved Code Exists?}
F -->|Yes| G[Return JSON with Code and State]
F -->|No| H[Return 404 Not Found]
style A fill:#f9d71c,stroke:#333,stroke-width:2px
style B fill:#f9d71c,stroke:#333,stroke-width:2px
style C fill:#f9d71c,stroke:#333,stroke-width:2px
style D fill:#a2d2ff,stroke:#333,stroke-width:2px
style E fill:#a2d2ff,stroke:#333,stroke-width:2px
style F fill:#f9d71c,stroke:#333,stroke-width:2px
style G fill:#a2d2ff,stroke:#333,stroke-width:2px
style H fill:#ffadad,stroke:#333,stroke-width:2px
This flow chart illustrates:
- The server start and initialization process
- How requests are handled for different endpoints
- The logic flow for saving and retrieving parameters
- Success and error states
Color coding:
- Yellow: Main flow and decision points
- Light Blue: Successful operations
- Light Red: Error state
This application is for demonstration purposes only. In a production environment, consider:
- π Implementing proper security measures
- π½ Using a database for persistent storage
- π§ͺ Adding error handling and input validation
Made with β€οΈ by Ronknight