https://github.com/gabepublic/local-simplesite-httpservers
Demonstrate simple http-servers for local web development
https://github.com/gabepublic/local-simplesite-httpservers
http-server nodejs python setup webapp website
Last synced: 2 months ago
JSON representation
Demonstrate simple http-servers for local web development
- Host: GitHub
- URL: https://github.com/gabepublic/local-simplesite-httpservers
- Owner: gabepublic
- License: apache-2.0
- Created: 2022-08-07T20:59:04.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-08T07:38:39.000Z (over 3 years ago)
- Last Synced: 2025-03-01T18:46:36.633Z (over 1 year ago)
- Topics: http-server, nodejs, python, setup, webapp, website
- Language: HTML
- Homepage:
- Size: 63.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# local-simplesite-httpservers
Demonstrate various simple http-servers for local web development which
includes:
- npm [http-server: a simple static HTTP server](https://www.npmjs.com/package/http-server)
- npm [serve](https://www.npmjs.com/package/serve)
- Python [http-server](https://docs.python.org/3/library/http.server.html)
In addition, we show deployment of the simple website to:
- "Render.com"
Also, the `index.html` page contains the `Login` link that integrates
with AWS Cognito, as well as the `loggedin.html` has `Logout` link that
logout from aws cognito.
## Prerequisite
- [Node.js & NPM](https://digitalcompanion.gitbook.io/home/setup/node.js)
- [Python](https://digitalcompanion.gitbook.io/home/setup/dev-environment/python)
## Setup
- Clone this repo
- Note: the `src` folder contains a very simple web site that will be served
by the simple http-server
## Serving website locally
### npm http-server
- Make sure `node.js` exists
```
npm --version
8.11.0
```
- Install the npm `http-server` module
```
npm install http-server
```
- Run the Http server
```
npm run http-server
# alternative
npx http-server ./src -p 8000
```
- Open browser and go to `http://localhost:8000`
- CTRL-C to terminate
### npm serve
- Make sure `node.js` exists
```
npm --version
8.11.0
```
- Install the npm `serve` module
```
npm install serve
```
- Run the Http server
```
npm run serve
```
- Open browser and go to `http://localhost:8000`
- CTRL-C to terminate
### python server
- Make sure Python exists
```
python3 --version
Python 3.8.10
```
- Make the script executable
```
chmod +x run-py-server.sh
```
- Run the Http server
```
./run-py-server.sh
```
## Deploy
### [Render.com](Render.com)
- Register an account with [Render.com](https://render.com/)
- Render documentation for [Static Sites](https://render.com/docs/static-sites)
- Deployment by linking this Github repo to Render
- Note: Static sites on Render are free, with no cost at all unless the
traffics go above 100 GB of bandwidth per month.
- **CLEANUP** - remember to delete the website using Render web console.
## References
- [Quick and easy HTTP servers for local development](https://timnwells.medium.com/quick-and-easy-http-servers-for-local-development-7a7df5ac25ff)
- [Render - Static Sites](https://render.com/docs/static-sites)