This repository will guide you through the process of creating a ExpressJS server/backend app, developing APIs, setting up a frontend Vanilla JavaScript application, and making a simple API call. The goal is to demonstrate how to seamlessly integrate and exchange data between the frontend and backend applications.
This repository contains the source code for a ExpressJS web application developed for INRIX HACK 2023. The application serves as a client-server demo example to help you get started with client-server interactions using ExpressJS and Bootstrap.
If you wish to see an Flask - Python example for the same project goto: FLask Python code example
- Home Page: A simple home page with Bootstrap styling.
- You can click the GetToken button in the navbar after hosting this app locally to print the token on the html page
- GetToken Endpoint: Access the
/getToken
endpoint to receive a JSON response with the Auth Token.
- npm & Node
-
Clone the Repository:
git clone [email protected]:<YOUR USER NAME>/INRIX_Hack_Client_Server_ExpressJS_Demo.git cd INRIX_Hack_Client_Server_Demo
-
Install Dependencies:
npm install
-
!!!! Make sure to paste your INRIX App_Id and Hash_Token here utils/authUtils.js
-
Start the Express App:
node main.js
Make sure to be in the same directory where you have your main.py file
-
Access the App: Open your web browser and go to http://127.0.0.1:5000/
-
Explore the App:
- Click on the "GetToken" link in the navigation bar to fetch and display the API token dynamically.
- main.py: ExpressJS application script.
- views/: HTML templates for the web pages.
- public/: Static files (CSS, JS).
If you want to learn how to parse a JSON Dataset, look at the json-parser-example.js Example
Happy Hacking!