KFVJ3KMWXEGILN4NWIWPPX7AU65M4H4UEAUIAQL2QSXOW3B5RFGQC
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nidobyte</title>
</head>
<body>
{% if flash %}
<p>{{flash}}</p>
{% endif %}
{% block body %}
{% endblock body %}
</body>
</html>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarsExample08" aria-controls="navbarsExample08" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-md-center" id="navbarsExample08">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Nidobyte</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdown08" data-bs-toggle="dropdown" aria-expanded="false">User</a>
<ul class="dropdown-menu" aria-labelledby="dropdown08">
<li><a class="dropdown-item" href="/users/sign_in">Sign in</a></li>
<li><a class="dropdown-item" href="/users/new">Sign up</a></li>
<li><a class="dropdown-item" href="/users/sign_out">Sign out</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
{% extends "base" %}
{% block body %}
<p>Hello world!</p>
{% endblock body %}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nidobyte</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script>
</head>
<body>
{% include "nav" %}
{% block body %}
<p> foo</p>
{% endblock body %}
</body>
</html>
use rocket::form::Context;
use rocket_dyn_templates::Template;
#[get("/")]
pub fn landing() -> Template {
Template::render("landing", &Context::default())
}
use std::env;
use rocket::{
fairing::{self, AdHoc},
Build, Rocket,
};
pub(crate) type Database = sqlx::PgPool;
async fn init_db(rocket: Rocket<Build>) -> fairing::Result {
let database_url = match env::var("DATABASE_URL") {
Ok(val) => val,
Err(e) => {
error!("Failed to read DATABASE_URL environment variable: {}", e);
return Err(rocket);
}
};
let pool = sqlx::PgPool::connect(&database_url)
.await
.expect("Failed to connect to the database");
if let Err(e) = sqlx::migrate!("./migrations").run(&pool).await {
error!("Failed to migrate PG database: {}", e);
return Err(rocket);
}
Ok(rocket.manage(pool))
}
pub fn stage() -> AdHoc {
AdHoc::on_ignite("SQL Stage - PostgreSQL", |rocket| async {
rocket.attach(AdHoc::try_on_ignite("Postgres Database", init_db))
})
}
use std::env;
use rocket::{
fairing::{self, AdHoc},
Build, Rocket,
};
pub(crate) type Database = sqlx::PgPool;
async fn init_db(rocket: Rocket<Build>) -> fairing::Result {
let database_url = match env::var("DATABASE_URL") {
Ok(val) => val,
Err(e) => {
error!("Failed to read DATABASE_URL environment variable: {}", e);
return Err(rocket);
}
};
let pool = sqlx::PgPool::connect(&database_url)
.await
.expect("Failed to connect to the database");
if let Err(e) = sqlx::migrate!("./migrations").run(&pool).await {
error!("Failed to migrate PG database: {}", e);
return Err(rocket);
}
Ok(rocket.manage(pool))
}
pub fn stage() -> AdHoc {
AdHoc::on_ignite("SQL Stage - PostgreSQL", |rocket| async {
rocket.attach(AdHoc::try_on_ignite("Postgres Database", init_db))
})
}