DEV Community

Philippe Vaillancourt
Philippe Vaillancourt

Posted on • Originally published at blog.snowfrog.dev on

Quick and easy local web server

Quick and easy local web server

I was working on the documentation for some of my open source libraries this week (@snowfrog/option and @snowfrog/result, check them out) and found myself wanting to quickly serve the documentation websites locally.

I'm using TypeDoc, which parses your TypeScript code and generates an entire API documentation website pretty much automatically. But seeing as it's an actual website and not just a simple static html file, you can't just open index.html in your browser and have the whole thing work. You need to actually serve the site with a web server.

Now I know there are different options out there for doing that, some are even integrated with your favourite IDEs and code editors. But this week I have found a way to do this that is amazingly simple and works from the command line; so it works no matter what you're doing and which software you are using in the moment.

All you need is to have Python 3 installed on your machine - you probably have it, if not here's a download link. Then, simply run the following command from the folder where your index.html is located:

python -m http.server 4200

Enter fullscreen mode Exit fullscreen mode

The 4200 here is the port number, you can make that whatever you want. For more information, here is a link the documentation for this Python http server module.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more