Skip to content

Commit

Permalink
Update IO for Nuxt 3
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlee85 committed Apr 19, 2024
1 parent 4df4feb commit a229859
Show file tree
Hide file tree
Showing 7 changed files with 23,371 additions and 14,303 deletions.
39 changes: 39 additions & 0 deletions examples/v7-nuxt3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
This is a [Nuxt3](https://nuxtjs.org/) project bootstrapped with `nuxi` and powered by [Edgio](https://edg.io).

## Getting Started

### Install Packages

```bash
npm install
```

### Local Development Server

```bash
npm run edgio:dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.vue`. The page auto-updates as you edit the file.

This project features caching and image optimization with Edgio. See `routes.js` for more details.

## Learn More

To learn more about Edgio, take a look at the following resources:

- [Edgio Documentation](https://docs.edg.io) - learn about Edgio features

## Deploy on Edgio

Deploy this project on Edgio with the following command:

```bash
npm run edgio:deploy
```

Check out our [Nuxt3 documentation](https://docs.edg.io/applications/v7/sites_frameworks/getting_started/nuxt3) for more details.

#
19 changes: 0 additions & 19 deletions examples/v7-nuxt3/edgio.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,6 @@ module.exports = {
sni_hint_and_strict_san_check: 'edgio-community-ecommerce-api-example-default.layer0-limelight.link',
},
},
{
name: 'image',
override_host_header: 'opt.moovweb.net',
hosts: [
{
scheme: 'match',
location: [
{
hostname: 'opt.moovweb.net',
},
],
},
],
tls_verify: {
allow_self_signed_certs: true,
use_sni: true,
sni_hint_and_strict_san_check: 'opt.moovweb.net',
},
},
],

// Options for hosting serverless functions on Edgio
Expand Down
14 changes: 9 additions & 5 deletions examples/v7-nuxt3/lib/helper.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
export const relativizeURL = (str) =>
str.replace(
'https://edgio-community-ecommerce-api-example-default.layer0-limelight.link/',
'/edgio-opt?quality=30&img=https://edgio-community-ecommerce-api-example-default.layer0-limelight.link/'
)
/**
* Returns a relative URL from a given URL. This is used to remove the origin from the image URL
* so that the image can be handled by Edgio router and processed by the image optimizer.
*/
export const relativizeURL = (str) => {
if (!str) return ''
// Return only the path and query string appended to /edgio-image/
return str.replace(/^(?:\/\/|[^/]+)*\//, '/edgio-image/')
}

export const getOrigin = (req) => {
let origin
Expand Down
Loading

0 comments on commit a229859

Please sign in to comment.