diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..957708f --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Admin-Host + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..784371d --- /dev/null +++ b/README.md @@ -0,0 +1,71 @@ +# LENS App + +This is a template Node.js web application that demonstrates how to use LENS for authentication. + +## Prerequisites + +- Node.js (v14 or higher) +- npm (v6 or higher) + +## Installation + +1. Clone the repository: + + ```sh + git clone https://github.com/LENSAuth/my-app.git + cd my-app + ``` + + - 1a. Use as template: + + To instead use this repository as a template for new projects, click the "Use this template" button on [the GitHub repository](https://github.com/LENSAuth/my-app), or click this link: [Create a new repository](https://github.com/new?template_name=my-app&template_owner=LENSAuth). + + ![Use this template](githubTemplate.gif) + +2. Install all dependencies: + + ```sh + npm install + ``` + +## Running the App + +1. Start the server: + + ```sh + node index.js + ``` + +2. Open your browser and navigate to `http://localhost:8080`. + +## Project Structure + +- `index.js`: Main server file that sets up the Express app and handles routes. +- `views/index.ejs`: EJS template file for rendering the main page. +- `.gitignore`: Specifies files and directories to be ignored by Git. +- `package.json`: Contains project metadata and dependencies. + +## Usage + +### GET Request + +- When you navigate to `http://localhost:8080`, the server will render the `index.ejs` file and display "Hello World!". + +### POST Request + +- The app listens for POST requests at the root URL (`/`). When a POST request is received, it logs the request body to the console and responds with a JSON message. + +### Popup Window + +- The `index.ejs` file includes a script that opens a popup window to `https://lens.admin-host.com` and listens for messages from this origin. +- When a message is received from the popup, it is logged to the console and displayed on the page. +- The message is also sent to the server via a POST request. + +## Notes + +- Ensure that the domain you are using is registered with LENS. For testing purposes, you can register `localhost`. +- The server logs the status and received data to the console. + +## License + +This project is licensed under the MIT License. diff --git a/githubTemplate.gif b/githubTemplate.gif new file mode 100644 index 0000000..1b0bf3f Binary files /dev/null and b/githubTemplate.gif differ diff --git a/package.json b/package.json index 2e32003..4a9432d 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "authentication" ], "author": "Admin-Host", - "license": "ISC", + "license": "MIT", "bugs": { "url": "https://github.com/LENSAuth/my-app/issues" },