68 lines
1.3 KiB
Plaintext
68 lines
1.3 KiB
Plaintext
---
|
|
import { createServer } from "miragejs"
|
|
import MirageTest from "../components/MirageTest"
|
|
|
|
createServer({
|
|
routes() {
|
|
this.namespace = "api"
|
|
|
|
this.get("/movies", () => {
|
|
return {
|
|
movies: [
|
|
{ id: 1, name: "Inception", year: 2010 },
|
|
{ id: 2, name: "Interstellar", year: 2014 },
|
|
{ id: 3, name: "Dunkirk", year: 2017 },
|
|
],
|
|
}
|
|
})
|
|
},
|
|
})
|
|
---
|
|
|
|
<html>
|
|
<body>
|
|
|
|
<ul id="nav-bar">
|
|
<li class="nav-bar-item"><a href="/home">Home</a></li>
|
|
<li class="nav-bar-item"><a href="/blog">Blog</a></li>
|
|
<li class="nav-bar-item"><a href="/microblog">Microblog</a></li>
|
|
<li class="nav-bar-item"><a href="/devlogs">Devlogs</a></li>
|
|
</ul>
|
|
|
|
<MirageTest client:load />
|
|
</body>
|
|
</html>
|
|
|
|
<style>
|
|
ul#nav-bar {
|
|
list-style-type: none;
|
|
margin: 0;
|
|
padding: 0;
|
|
width: 200px;
|
|
background-color: #f1f1f1;
|
|
border: 1px solid #555;
|
|
}
|
|
|
|
ul#nav-bar li {
|
|
text-align: center;
|
|
display: inline;
|
|
}
|
|
|
|
li.nav-bar-item a {
|
|
display: block;
|
|
color: #000;
|
|
padding: 8px 16px;
|
|
text-decoration: none;
|
|
border: 1px solid #555;
|
|
}
|
|
|
|
li.nav-bar-item:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
li.nav-bar-item a:hover {
|
|
background-color: #555;
|
|
color: white;
|
|
}
|
|
</style>
|