Create static file endpoints
This commit is contained in:
parent
ac64fd8ebe
commit
64e810d360
2 changed files with 16 additions and 4 deletions
18
src/main.rs
18
src/main.rs
|
|
@ -1,10 +1,22 @@
|
||||||
mod project;
|
use rouille::router;
|
||||||
|
|
||||||
mod db;
|
mod db;
|
||||||
|
mod project;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Starting server on localhost:8080");
|
println!("Starting server on localhost:8080");
|
||||||
|
|
||||||
rouille::start_server("localhost:8080", move |_request| {
|
rouille::start_server("localhost:8080", move |request| {
|
||||||
rouille::Response::empty_404()
|
router!(request,
|
||||||
|
(GET) ["/main.css"] => {
|
||||||
|
let css = include_bytes!("main.css");
|
||||||
|
rouille::Response::from_data("text/css", css.as_ref())
|
||||||
|
},
|
||||||
|
(GET) ["/project-card.js"] => {
|
||||||
|
let js = include_bytes!("project-card.js");
|
||||||
|
rouille::Response::from_data("application/javascript", js.as_ref())
|
||||||
|
},
|
||||||
|
_ => rouille::Response::empty_404()
|
||||||
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
todo.md
2
todo.md
|
|
@ -6,7 +6,7 @@
|
||||||
[x] Create a module or struct at your discretion for interfacing with the database. Create functions for the following: create a project, update a project's progress, archive a project, unarchive a project, and list of all projects.
|
[x] Create a module or struct at your discretion for interfacing with the database. Create functions for the following: create a project, update a project's progress, archive a project, unarchive a project, and list of all projects.
|
||||||
[x] Create a `main.css` file in src. Use mvp.css as a starting point.
|
[x] Create a `main.css` file in src. Use mvp.css as a starting point.
|
||||||
[x] Create a `project-card.js` file in src that creates a web component for displaying a project.
|
[x] Create a `project-card.js` file in src that creates a web component for displaying a project.
|
||||||
[ ] Using a Rouille router, create `GET /main.css` and `GET /project-card.js` endpoints that returns the relevant files. Use the include_bytes! macro.
|
[x] Using a Rouille router, create `GET /main.css` and `GET /project-card.js` endpoints that returns the relevant files. Use the include_bytes! macro.
|
||||||
[ ] Create a `GET /projects` endpoint. Using Maud for markup generation, have this endpoint return an HTML page that shows all projects. Each project should be a `project-card` web component. Keep the page simple: no title or any buttons currently.
|
[ ] Create a `GET /projects` endpoint. Using Maud for markup generation, have this endpoint return an HTML page that shows all projects. Each project should be a `project-card` web component. Keep the page simple: no title or any buttons currently.
|
||||||
[ ] Create a `POST /projects` endpoint that accepts URL encoded data and creates a new project.
|
[ ] Create a `POST /projects` endpoint that accepts URL encoded data and creates a new project.
|
||||||
[ ] Create a `GET /new-project` endpoint that returns a HTML page with a project creation form. Keep it simple.
|
[ ] Create a `GET /new-project` endpoint that returns a HTML page with a project creation form. Keep it simple.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue