Strapi: API generator creates mongoose infrastrucutre although connected with bookshelf

Created on 13 Feb 2018  路  3Comments  路  Source: strapi/strapi

Deniss-Air-2:fourth minimalist$ node --version && strapi -version && npm -version && uname
v9.5.0
3.0.0-alpha.9.3
5.6.0
Darwin

Do you want to request a feature or report a bug?
Bug
What is the current behavior?
API generator creates mongoose infrastructure instead of bookshelf. If the api is generated throught
the content manager everything is ok.
If the current behavior is a bug, please provide the steps to reproduce the problem
Configure new strapi project for mysql -> db connector is strapi-bookshelf
use generator on terminal to generate any new api
see into apis services -> mongoose api calls were generated

{
  "defaultConnection": "default",
  "connections": {
    "default": {
      "connector": "strapi-bookshelf",
      "settings": {
        "client": "mysql",
        "host": "127.0.0.1",
        "port": 3306,
        "database": "fourth",
        "username": "root",
        "password": ""
      },
      "options": {}
    }
  }
}


  add: async (values) => {
    const data = await Service.create(_.omit(values, _.keys(_.groupBy(strapi.models.service.associations, 'alias'))));
    await strapi.hook.mongoose.manageRelations('service', _.merge(_.clone(data), { values }));
    return data;
  },

What is the expected behavior?
Bookshelf API Calls should be there.

high bug

Most helpful comment

@funkhauscreative https://strapi.io/documentation/3.x.x/cli/CLI.html#strapi-generate-api

strapi generate:api <name> --tpl <template>
Generates an API called <name> in the ./api folder which works with the given <template>. By default, the generated APIs are based on Mongoose.

You need to specify the bookshelf template strapi generate:api -t bookshelf test

All 3 comments

Hello @denislutz. Please update your Strapi version, it works fine on [email protected].
You will be able to fine migration guides in our documentation.

Hi @lauriejim,

I'm running the CLI on alpha14.5. strapi generate:api test is still creating a Mongoose service page.

These are my database setting (for all environments):

{
  "defaultConnection": "default",
  "connections": {
    "default": {
      "connector": "strapi-hook-bookshelf",
      "settings": {
        "client": "mysql",
        "host": "127.0.0.1",
        "srv": false,
        "port": 3306,
        "database": "dbname",
        "username": "****",
        "password": "****"
      },
      "options": {
        "ssl": false
      }
    }
  }
}

@funkhauscreative https://strapi.io/documentation/3.x.x/cli/CLI.html#strapi-generate-api

strapi generate:api <name> --tpl <template>
Generates an API called <name> in the ./api folder which works with the given <template>. By default, the generated APIs are based on Mongoose.

You need to specify the bookshelf template strapi generate:api -t bookshelf test

Was this page helpful?
0 / 5 - 0 ratings

Related issues

derrickmehaffy picture derrickmehaffy  路  3Comments

isabellachen picture isabellachen  路  3Comments

profjefferson picture profjefferson  路  3Comments

wes-cutting picture wes-cutting  路  3Comments

OrestTs picture OrestTs  路  3Comments