Skip to content

Commit

Permalink
♻️ Move api to example folder
Browse files Browse the repository at this point in the history
lluerich committed May 27, 2019
1 parent ee0a58e commit 62c653a
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -22,13 +22,11 @@ const upload = multer();
// eslint-disable-next-line new-cap
const examples = express.Router();

examples.post('/rating/set', upload.none(), handleRating);

function handleRating(request, response) {
examples.post('/set', upload.none(), (request, response) => {
const rating = request.body ? request.body.rating : '';
response.json({
rating,
});
}
});

module.exports = examples;
Original file line number Diff line number Diff line change
@@ -129,7 +129,7 @@
We want the form to submit as soon as the user makes a selection, without a Submit button. To do that, we'll set the [`on` attribute](https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#on) of the `input`s to submit the form on [`change`]({{g.doc('/content/amp-dev/documentation/components/reference/amp-form.md', locale=doc.locale).url.path}}#input-events).
The initial rating is determined by which radio button has the `checked` attribute set. This is optional. -->
<form id="rating" class="p2" method="post" action-xhr="/documentation/examples/api/rating/set" target="_blank">
<form id="rating" class="p2" method="post" action-xhr="set" target="_blank">
<fieldset class="rating">
<input name="rating" type="radio" id="rating5" value="5" on="change:rating.submit"/>
<label for="rating5" title="5 stars"></label>

0 comments on commit 62c653a

Please sign in to comment.