leafo / lapis

A web framework for Lua and OpenResty written in MoonScript
http://leafo.net/lapis/
MIT License
3.14k stars 247 forks source link

How to delete the html code inserted by default? #721

Closed ghost closed 3 years ago

ghost commented 3 years ago

I am using the template system with lua but lapis adds html code by default, do you know how I can delete that html code?, for example:

<!DOCTYPE HTML><html lang="en"><head><title>Lapis Page</title></head><body><!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="utf-8">
    <title>nabu</title>
</head>
<body>
<h1>nabu</h1>
</body>
</html></body></html>
leafo commented 3 years ago

You can pass layout = false on the render options to disable it for that request, or you can set layout = false on on app instance to disable it by default for all requests

ghost commented 3 years ago

only with this code for example?

local lapis = require("lapis")
local app = lapis.Application()
app:enable("etlua")
local layout = false
leafo commented 3 years ago

only with this code for example?

local lapis = require("lapis")
local app = lapis.Application()
app:enable("etlua")
local layout = false

In this example you create a local variable named layout and set it to false, this will have no effect on anything related to lapis.

You can change the layout setting on the app in your example code like so:

app.layout = false
ghost commented 3 years ago

thanks leafo it worked, I'm still new to lua, greetings and hugs

ghost commented 3 years ago

@leafo what is the difference of types.numeric and types.integer?

ghost commented 3 years ago

and in the validation functions you can tell me an example of type: String I can't understand how it works: 'c

ghost commented 3 years ago

@leafo please set into documentation that types.numeric is a TINYINT