Skip to content

Commit

Permalink
Add Demo deployment and link
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkosima committed May 13, 2019
1 parent 052bc72 commit 3b179db
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 8 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Books Search

Under the hood:
## [**Demo**](https://books-search.mrkosima.now.sh)

![books-search](/docs/books-search.gif "Books Search")

### Under the hood:
- TypeScript
- [lit-html](https://github.com/polymer/lit-html)
- [lit-elements](https://github.com/polymer/lit-element)
- [Speech Recongition API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition)
- [Open Library API](https://openlibrary.org/developers/api)


Useful resources:
#### Useful resources:
- [Custom Elements v1: Reusable Web Components](https://developers.google.com/web/fundamentals/web-components/customelements)
- [Using the Web Speech API
](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API/Using_the_Web_Speech_API)
Expand Down
Binary file added docs/books-search.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions now.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": 2,
"name": "books-search",
"builds": [
{
"src": "package.json",
"use": "@now/static-build",
"config": { "distDir": "build" }
}
],
"routes": [
{
"src": "/static/(.*)",
"headers": { "cache-control": "s-maxage=31536000,immutable" },
"dest": "/static/$1"
},
{ "src": "/favicon.ico", "dest": "/favicon.ico" },
{ "src": "/asset-manifest.json", "dest": "/asset-manifest.json" },
{ "src": "/manifest.json", "dest": "/manifest.json" },
{ "src": "/precache-manifest.(.*)", "dest": "/precache-manifest.$1" },
{
"src": "/service-worker.js",
"headers": { "cache-control": "s-maxage=0" },
"dest": "/service-worker.js"
},
{
"src": "/(.*)",
"headers": { "cache-control": "s-maxage=0" },
"dest": "/index.html"
}
]
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"start": "webpack-dev-server --config webpack.dev.js",
"lint": "eslint",
"build": "webpack --config webpack.prod.js"
"build": "webpack --config webpack.prod.js",
"now-build": "yarn build"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions src/api/booksService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface Book {

export type Books = Book[];

const SEARCH_API = "http://openlibrary.org/search.json";
const SEARCH_API = "https://openlibrary.org/search.json";

const prepareQueryString = (text: string) =>
text
Expand All @@ -41,7 +41,7 @@ const getCoverUrl = (
value: string,
size: "S" | "M" | "L"
) =>
`http://covers.openlibrary.org/a/${key}/${value}-${size}.jpg?default=false`;
`https://covers.openlibrary.org/a/${key}/${value}-${size}.jpg?default=false`;

const getCoverUrls = (coverId: number): CoverUrils => ({
small: getCoverUrl("id", coverId.toString(), "S"),
Expand Down
8 changes: 5 additions & 3 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ module.exports = {
booksSearch: "./src"
},
output: {
filename: "[name].[chunkhash].bundle.js",
path: path.resolve(__dirname, "build")
filename: "static/[name].[chunkhash].bundle.js",
path: path.resolve(__dirname, "build"),

},
module: {
rules: [
Expand All @@ -25,7 +26,8 @@ module.exports = {
title: "Books Search",
template: "./public/index.html",
favicon: "./public/favicon.ico",
inject: "head"
inject: "head",
baseUrl: "/"
})
]
};

0 comments on commit 3b179db

Please sign in to comment.