Skip to content

Commit

Permalink
fixup! apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nabdelgadir committed May 10, 2019
1 parent 6f24664 commit 6c571c3
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 624 deletions.
25 changes: 19 additions & 6 deletions examples/lb3-application/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ new LoopBack 4 project.
$ lb4 app
```

2. Create a new directory `lb3app` and copy your existing LoopBack 3 application
there. You should end up with the following directory layout:
2. Create a new directory `lb3app` from the root of your LoopBack 4 application
and copy your existing LoopBack 3 application there. You should end up with
the following directory layout:

```
lb3app/
Expand All @@ -30,8 +31,9 @@ new LoopBack 4 project.
```

3. Move LB3 dependencies to the main package.json file and remove
`lb3app/package.json`. Typically you will need to add the following entries,
plus any connectors or components you are using in your LB3 application.
`lb3app/package.json`, `lb3app/node_modules/`, and`lb3app/package-lock.json`,
if it exists. Typically you will need to add the following entries, plus any
connectors or components you are using in your LB3 application.

```json
{
Expand All @@ -43,21 +45,32 @@ new LoopBack 4 project.
}
```

Run `npm install` from the root of your LB4 project to install the LB3
dependencies.

4. Disable error handling in your LB3 app, leave it for the new LB4 app.

- Remove `lb3app/server/middleware.development.json`
- Edit `lb3app/server/middleware.json` and remove the following two entries:
- `final` >> `loopback#urlNotFound`
- `final:after` >> `strong-error-handler`
- Remove `strong-error-handler` from `package.json` dependencies.
- In `lb3app/server/config.json`, if `"handleErrors": false` is in
`remoting`, move it to `rest`.

5. Move your front-end files from `lb3app/client` to `public/` directory and
disable static assets in your LB3 app by removing the following entry in
`lb3app/server/middleware.json`:

- `files` >> `loopback#static`

6. Install and configure `@loopback/booter-lb3app` to boot and mount the LB3
Also remove `lb3app/server/boot/root.js`, since the main page will be served
by the LoopBack 4 project.

6. Remove `lb3app/server/component-config.json` to disable LoopBack 3's
explorer. The LoopBack 4 explorer will be used instead.

7. Install and configure `@loopback/booter-lb3app` to boot and mount the LB3
application:

1. `npm install --save @loopback/booter-lb3app`
Expand All @@ -71,7 +84,7 @@ new LoopBack 4 project.
3. Register the component in Application's constructor:

```ts
this.components(Lb3AppBooterComponent);
this.component(Lb3AppBooterComponent);
```

## Try it out
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const debug = require('debug')('loopback:example:lb3application');
module.exports = async function(app) {
await app.dataSources.db.automigrate('CoffeeShop');

const coffeeShops = app.models.CoffeeShop.create([
const coffeeShops = await app.models.CoffeeShop.create([
{
name: 'Bel Cafe',
city: 'Vancouver',
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions examples/lb3-application/lb3app/server/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"remoting": {
"context": false,
"rest": {
"handleErrors": false,
"normalizeHttpPath": false,
"xml": false
},
Expand All @@ -16,7 +17,6 @@
"extended": true,
"limit": "100kb"
},
"cors": false,
"handleErrors": false
"cors": false
}
}

0 comments on commit 6c571c3

Please sign in to comment.