Skip to content

Commit

Permalink
Temporarily host REM on fly to fix the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JAForbes authored and dead-claudia committed Jun 8, 2024
1 parent 2a8412e commit 8c87814
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ m.route(root, "/splash", {

Basically, XHR is just a way to talk to a server.

Let's change our click counter to make it save data on a server. For the server, we'll use [REM](https://rem-rest-api.herokuapp.com), a mock REST API designed for toy apps like this tutorial.
Let's change our click counter to make it save data on a server. For the server, we'll use [REM](https://mithril-rem.fly.dev), a mock REST API designed for toy apps like this tutorial.

First we create a function that calls `m.request`. The `url` specifies an endpoint that represents a resource, the `method` specifies the type of action we're taking (typically the `PUT` method [upserts](https://en.wiktionary.org/wiki/upsert)), `body` is the payload that we're sending to the endpoint and `withCredentials` means to enable cookies (a requirement for the REM API to work)

Expand All @@ -330,7 +330,7 @@ var count = 0
var increment = function() {
m.request({
method: "PUT",
url: "//rem-rest-api.herokuapp.com/api/tutorial/1",
url: "//mithril-rem.fly.dev/api/tutorial/1",
body: {count: count + 1},
withCredentials: true,
})
Expand Down Expand Up @@ -366,7 +366,7 @@ var count = 0
var increment = function() {
m.request({
method: "PUT",
url: "//rem-rest-api.herokuapp.com/api/tutorial/1",
url: "//mithril-rem.fly.dev/api/tutorial/1",
body: {count: count + 1},
withCredentials: true,
})
Expand Down
18 changes: 9 additions & 9 deletions docs/simple-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A complete walkthrough tutorial for building your first simple application in Mi

Let's develop a simple application that shows off how to do most of the major things you would need to deal with while using Mithril.

*An interactive example of the end result can be seen [here](https://flems.io/#0=N4IgzgpgNhDGAuEAmIBcICqkBOBZA9ktAHQBWYIANCAGYCWMFqA2qAHYCGAthGpjgSJQyFarHxtEkvgDcO2AARYIigLwLgAHTYLdCqHTDxUC5gF1K2vfvw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ibBzkQBzUau5kiHk6peeSfVXzAiatImSlZFqFBWpVYEH5wV-mAofO60FqlwXQQFRATo0roWwvlf68NUzg1OsDRG5VUz2XErgFyy8lLqXJOFcmnlzKVAavTacrN-yIAYt3buoVz4LAgAFaMJgrBS5vnAdscSDBTxVD4KWUUixvrHIVLMPqmRsAMAAAIxOIHE4gAAWFon7b3CD6g04B-1AZ8DALAb9DQorXDMNcIAA)*
*An interactive example of the end result can be seen [here](https://flems.io/#0=N4IgzgpgNhDGAuEAmIBcICqkBOBZA9ktAHQBWYIANCAGYCWMFqA2qAHYCGAthGpjgSJQyFarHxtEkvgDcO2AARYIigLwLgAHTYLdCqHTDxUC5gF1K2vfvwckAGUPGFNAK5sEdCQAoAlBqtrPWwIeFdsHS5iEIBHVwgjby0dINSeeAALQhNNEABxAFEAFVzLFNTrcKgckAz4eAAHMFQAehauOkzsBgBaEKiaKABPYiIZFo4GuhbXHDBSwIq9AHdOjIBhEKJJOg4oZoV4bHiypYBfX0Wg4kyINm83D3gve5CwVyh4f2Sl62VsYgGIwKdRvD7wUYceAcK7WC5XM5lK6wcIhSQmYCIq5QWxIEyPTw+OhIb6w4KhcKRaIQOIJeBJMlpUJZPEKXKFEpURlBKo1OqNZptDpdXr9YiDEZjCZTGZzFq5BQAagUxNOv10q0ym2Qd2eewORxO3Ph5Wut3uBOePjBn1JpqW-2IKOwaPgIIUNvgxsupqxbCuYA4Mgg+PchPudqWITCEQUUVi8USP3VceZ2TZIAAChhOWr1byM-ymq12mtulA+hABsNRhBxpNprMVGB5SAlUocE7UbriKrudYAEaEIYmR3O11536ajZbXW7fYmQ0QSdwn1w7RnbRUcDQOBWthMEAAVlQABYj5QAIwAdjPF4ATAAOO8gRHsbi8dD-RxGETb8SSLqsjyB2Kg-m66jJroEh0GwnSjp2OJ2OBk4yHQEDLKGTwvH4AT2uSMaRN4uTEE22A9ECXpUKBAKUcQXCTA8Yb7t4ZGRim0aUnG3jxvgriIMQjhsAA1pQGgZCENA1C0yCdK27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GpRHoRghgwB8RICA5S4zOy6T0opzSUgNDsEgWCNMTDJMGZktgpEcC6SMPpRACVkwDk1sJGm2A+JsFZCghaTyODzKHNgWRl4QkKDAPgAwSAFAoKQEC+Z4gcTYBMCg3pUL5mbLABrEcCgBw4lgMJeZnS2A7OWZ8kG8z1lAq2SYR8XzLxHlWboUG8AehEHENgKELwZlsDmS0g5Iy9IGS4KgLIwZFDJgpVSuAIU6USBMO4BGBhGV7P9Ac8WI1YXwpMEi3BqK4mLIxcs7ppKcXMucfxEabyPlfJ+X8gFQKkCvJCgjPodg6CzBML0sliL8BVLAHQAAXgSx17yVA9CHFqlIcq1IIsVSitFqrMXdIaQ6vFmy2DbJWUgklDqal1KKckgApJKrJMdI46AuVcm5dyHkQGLear14KAmGt+cSE1wLAj6u9bSzZtqFD2r9boUFIUIVQt6TCww8qVRsHFRAH1yLlUpHReG+NuKNkesjQmzV8y+XUsFfuBlTKMlSrcbHDFXKVB6vzbc0VEKICPhPSeyVr4LAgHFcJJgrBzH+WgWWBg24qh8CLIKGY31rlOnwFwUsIooAAAF7zEGScQU8AGJIMHosPauIB-qAz4GAWA3QGjRTOGYM4QA)*

First let's create an entry point for the application. Create a file `index.html`:

Expand Down Expand Up @@ -80,7 +80,7 @@ var User = {
module.exports = User
```

Then we can add an `m.request` call to make an XHR request. For this tutorial, we'll make XHR calls to the REM (DEAD LINK, FIXME: https //rem-rest-api.herokuapp.com/) API, a mock REST API designed for rapid prototyping. This API returns a list of users from the `GET https://rem-rest-api.herokuapp.com/api/users` endpoint. Let's use `m.request` to make an XHR request and populate our data with the response of that endpoint.
Then we can add an `m.request` call to make an XHR request. For this tutorial, we'll make XHR calls to the REM (DEAD LINK, FIXME: https //rem-rest-api.herokuapp.com/) API, a mock REST API designed for rapid prototyping. This API returns a list of users from the `GET https://mithril-rem.fly.dev/api/users` endpoint. Let's use `m.request` to make an XHR request and populate our data with the response of that endpoint.

*Note: third-party cookies may have to be enabled for the REM endpoint to work.*

Expand All @@ -93,7 +93,7 @@ var User = {
loadList: function() {
return m.request({
method: "GET",
url: "https://rem-rest-api.herokuapp.com/api/users",
url: "https://mithril-rem.fly.dev/api/users",
withCredentials: true,
})
.then(function(result) {
Expand Down Expand Up @@ -422,7 +422,7 @@ var User = {
loadList: function() {
return m.request({
method: "GET",
url: "https://rem-rest-api.herokuapp.com/api/users",
url: "https://mithril-rem.fly.dev/api/users",
withCredentials: true,
})
.then(function(result) {
Expand All @@ -445,7 +445,7 @@ var User = {
loadList: function() {
return m.request({
method: "GET",
url: "https://rem-rest-api.herokuapp.com/api/users",
url: "https://mithril-rem.fly.dev/api/users",
withCredentials: true,
})
.then(function(result) {
Expand All @@ -457,7 +457,7 @@ var User = {
load: function(id) {
return m.request({
method: "GET",
url: "https://rem-rest-api.herokuapp.com/api/users/" + id,
url: "https://mithril-rem.fly.dev/api/users/" + id,
withCredentials: true,
})
.then(function(result) {
Expand Down Expand Up @@ -563,7 +563,7 @@ var User = {
loadList: function() {
return m.request({
method: "GET",
url: "https://rem-rest-api.herokuapp.com/api/users",
url: "https://mithril-rem.fly.dev/api/users",
withCredentials: true,
})
.then(function(result) {
Expand All @@ -575,7 +575,7 @@ var User = {
load: function(id) {
return m.request({
method: "GET",
url: "https://rem-rest-api.herokuapp.com/api/users/" + id,
url: "https://mithril-rem.fly.dev/api/users/" + id,
withCredentials: true,
})
.then(function(result) {
Expand All @@ -586,7 +586,7 @@ var User = {
save: function() {
return m.request({
method: "PUT",
url: "https://rem-rest-api.herokuapp.com/api/users/" + User.current.id,
url: "https://mithril-rem.fly.dev/api/users/" + User.current.id,
body: User.current,
withCredentials: true,
})
Expand Down

0 comments on commit 8c87814

Please sign in to comment.