Skip to content

Commit

Permalink
basic form setup and response messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Aug 8, 2023
1 parent 6a9fb5f commit e0b4151
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/api/greeting.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getMessage } from '../services/message.js';

export async function handler(request) {
console.log({ request });
const params = new URLSearchParams(request.url.slice(request.url.indexOf('?')));
const name = params.has('name') ? params.get('name') : 'Greenwood';
const body = getMessage(name);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h2>Greeting API</h2>
>
<label>
Greetings Text
<input type="text" required/>
<input type="text" name="name" required/>
</label>
<button type="submit">Click me for a greeting!</button>
</form>
Expand Down
2 changes: 1 addition & 1 deletion src/services/message.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function getMessage(name) {
return `Hello ${name}!`;
return `Hello ${name}! 👋`;
}

export {
Expand Down

0 comments on commit e0b4151

Please sign in to comment.