commit a88da118db8b0eed41266e7b281628c444991c24 Author: Gerardo Marx Date: Thu Jul 10 16:06:46 2025 +0000 initial commit diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..6ff1966 --- /dev/null +++ b/Readme.md @@ -0,0 +1,68 @@ +# Basic procedure to init a JS proyect +This basic repository shows how to prepare basic JS apps to run and test in Unix like OS. The guide use the `serve` node package installed globally; alternally you can use `live server` extension in visual studio code to mount a basic server for testing. + +## 1. Create the project directory + +```sh +mkdir my-js-project +cd my-js-project +``` + +## 2. Create the basic files + +```sh +touch index.html +touch script.js +``` + +**index.html** +```html + + + + + Test JS + + +

Hello Blink!

+ + + + +``` + +**script.js** +```js +function sayHello() { + alert("Hello from JS!"); + console.log("Hello from script.js!"); +} +``` + +## 3. Install a simple static server +If you want to serve this app via a web browser use: +```sh +npm install -g serve +``` +This will install globally, if you already do not have installed, and then you can use later for this or further js projects: +```sh +serve . +``` +By default it serves on `http://localhost:3000` + +## 4. Access it in the web browser +Once you execute the `serve` commmand a prompt will let you know where your server is serving: + +```sh +Serving! ││ ││ - Local: http://localhost:3000 ││ - Network: http://172.18.0.2:3000 +``` +thus, you can visit it locally or in other device with the `network` address. + +**Note: if you are using Blink Shell app for iPad** you must open other Blink terminal and forward the the exposed port: +```sh +Blink> build port add htools 3000 3000 +``` + +after that you will be able to open the app only directly from your iPad if you did it by `Blink Build`. Otherwise, the app will be abaileble at the provided URL. + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..eff6fd1 --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + + + + Test JS + + +

Hello Blink!

+ + + + diff --git a/script.js b/script.js new file mode 100644 index 0000000..5e71898 --- /dev/null +++ b/script.js @@ -0,0 +1,4 @@ +function sayHello() { + alert("Hello from JS!"); + console.log("Hello from script.js!"); +}