我如何使用Hypnotoad作为http服务器

PMa*_*Mat 2 perl mojolicious web

我试图使用hypnotoad服务器来提供一些静态的html页面.我需要做什么配置或在哪里保留我的静态html文件以供催眠选择它们.

谢谢!!

Joe*_*ger 9

IIRC由Mojolicious提供的服务器(其中Hypnotoad是其中之一)从名为的文件夹提供静态HTML public.您需要的只是启动服务器的最基本的应用程序.我应该足够简单使用,

#!/usr/bin/env perl
use Mojolicious::Lite;

# needed to setup the usual index.html landing
any '/' => sub {
  shift->render_static('index.html');
};

app->start;
Run Code Online (Sandbox Code Playgroud)

并运行hypnotoad myapp.pl(假设此脚本保存为myapp.plpublic文件夹位于同一位置).