Crates.io | realm |
lib.rs | realm |
version | 0.1.23 |
source | src |
created_at | 2019-07-08 06:34:18.418851 |
updated_at | 2020-06-23 13:45:17.774001 |
description | Rust / Elm base full stack web framework. |
homepage | https://github.com/ackotech/realm |
repository | https://github.com/ackotech/realm |
max_upload_size | |
id | 147475 |
size | 97,591 |
Rust / Elm base full stack web framework.
Must have ownership for particular crate at crates.io
Must have login through terminal using cargo token.
Change current version in Cargo.toml in increasing way (Digit places should be change according to feature).
Do cargo check --all
should not have any compile error, warning nothing.
Do cargo fmt
Do git add <changes files>
Do git commit -m "message related to your changes"
Do git push
Do cargo package
Do cargo publish
, It should be successfully published.
fn main() {
for entry in walkdir::WalkDir::new("templates") {
let entry = entry.unwrap();
eprintln!("cargo:rerun-if-changed={}", entry.path().display());
}
}
// with the following in your Cargo.toml
// [package]
// build = "build.rs"
//
// [build-dependencies]
// walkdir = "2"
navigate : String -> Cmd (Msg msg)
in Realm.elm
.mif : Maybe a -> (a -> E.Element msg) -> E.Element msg
in Utils.elm
.realm::base::In
:
ud
cookie is empty.ud
cookie is not empty.HOST
is localhost, 127.0.0.1 or 127.0.0.2.error<T>(key: &str, message: &str)
. Returns a FormError
containing the key
and message
.json<T>(&mut self, name: &str)
in RequestConfig
. Takes a field name name
and returns it's value if present in the body of the request.realm::base::pg
and realm::base::sqlite
:
ud
cookie. This change is not compatible with the previous realm versions. Please refer to UDMIGRATION.md guide.Cargo.toml
to use database:
Postgres: postgres+postgres_default
SQLite: sqlite+sqlite_default
Realm.Test
on error from server, report it and keep tests running.realm::RequestConfig::required()
etc methods now return realm::Error(InputError)
instead of realm::request_config::Error
, middleware need only catch single error
now: let resp = match forward::magic(&in_) {
Ok(r) => Ok(r),
Err(e) => {
match e.downcast_ref::<realm::Error>()
{
Some(realm::Error::PageNotFound {message}) => fifthtry::http404(&in_, message.as_str()),
Some(realm::Error::InputError {error}) => fifthtry::http404(&in_, &error.to_string()),
_ => Err(e)
}
}
};
window.realm_extra_ports
in Javascript
. Applications can create Ports.elm
and
specify ports like this: port something : JE.Value -> Cmd msg
. Applications can
create a Javascript file and add the port and callback function like this to
window.realm_extra_ports
:window.realm_extra_ports = {
"something": function(data) {
}
};
// the realm app is available as window.realm_app. so you can also do:
window.addEventListener("foo", function(evt) { window.realm_app.ports.foo.send(evt) })
index.html
and realm
will use this while rendering a page. index.html
must contains special strings:
__realm_title__
and __realm_data__
, these will be replaced by page title and page
data.APP_NAME
feature, use custom index.html
to overwrite script name instead.window.realm_app_init()
and window.realm_app_shutdown()
hooks, if you want
to do something after realm app is initialized and is shutting down.In.darkMode
.realm::base::CiString
is public now.Realm.Utils.html
and
Realm.Utils.htmlLine
to take Realm.Utils.Rendered
as input instead of String
.Realm.Test
: show failures in redRealm.Test
: keyboard shortcut e
to toggle between showing all tests vs only
failed onesRealm.Test
: on test completion narrow to only failed tests if test failed..required2()
, .required3()
and .required4()
to
realm::request_config::RequestConfig
. Advantage of these variants over multiple
invocations of .required()
: all errors are shown in one go, with .required()
, only
the first error is shown in response.Realm.Utils.maybe : Json.Decode.Decoder a -> Json.Decode.Decoder (Maybe a)
,
which is a better version of Json.Decode.maybe
.Realm.Utils.iff : Bool -> E.Element msg -> E.Element msg
(show something or
use E.none if false).Realm.Utils.escEnter
to attach event handler for Escape and Enter keys. Also
.onEnter
, .onSpaceAndEnter
and .button
.Realm.Utils.mapIth
and .mapAIth
for updating ith member of a list/array.realm::is_realm_url()
and realm::handle()
to handle realm related URLs.realm::base::rollback_if_required()
now rolls back if transaction depth managed
by diesel is wrong.Elm
, then getApp()
returns
none instead of crashing, so it is consistent with what happens when a non nested,
missing elm module is sent.realm::Response::redirect(next)
and realm::Response::redirect_with(next, StatusCode)
methods. In Layout
mode, redirect to next
page. In HTML/API
mode,
sends HTTP 3xx response with location
header as next
.elm.js
if APP_NAME
environment variable is configured:
/static/APP_NAME/elm.js
. Default location for elm.js
is /static/elm.js
.realm::base::db::db_test()
back.realm::base::db::RealmConnection
: in release build this is an alias for
PgConnection
, where as in debug build its an alias for DebugConnection
, which
prints SQL queries and time for execution. It also prints every connection
established and the time it took to establish the connection.realm::base::UserStatus
type.Realm.Utils.html
and Realm.Utils.htmlLine
helpers to render server generated
HTML in Elm.
elm install hecrj/html-parser
inside
'frontend' folder.realm::base::FormError::empty()
, and deprecated ::new()
.realm::base::FormError::single()
to create one off error messages.realm::Error
and realm::request_config::Error
so we can do following error
handling in middleware:if e.downcast_ref::<realm::Error>().is_some()
|| e.downcast_ref::<realm::request_config::Error>().is_some()
{
fifthtry::http404(&in_, error.as_str())
} else {
Err(e)
}
realm::Or404
trait and implemented it on Result<T, failure::Error>
so one
can do eg let content = fifthtry_db::content::get(in_, id).or_404()?;
in routes to
convert arbitrary errors to 404s.realm::request_config::RequestConfig.optional()
, to get optional values..param()
or .optional()
, now onwards null
in
json, and empty value in query params are treated same as missing keys..param()
to .required()
, which goes better with .optional()
.Added RequestConfig.param()
to get a parameter from request.
Deprecated RequestConfig.get()
, .param()
should be used now.
Added Realm.tuple : JD.Decoder a -> JD.Decoder b -> JD.Decoder (a, b)
and
Realm.tupleE : (a -> JE.Value) -> (b -> JE.Value) -> ((a, b) -> JE.Value)
.
Fix: Query params in URLs are not lost during navigation.
Fix: Device switching in /storybook/ was buggy in some cases.
realm::Response
now implements serde::Serialize
.Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!