GithubHelp home page GithubHelp logo

paynegreen / nuxt-devless Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 10 KB

A DevLess backend connector for NuxtJS (https://nuxtjs.org)

Home Page: https://devless.io

License: Apache License 2.0

JavaScript 100.00%
nuxtjs plugins devless backend authentication

nuxt-devless's Introduction

Nuxt-Devless

A DevLess backend connector for NuxtJS (https://nuxtjs.org)

Connect your Nuxt app to the DevLess backend to store data.

Requirments

  1. Axios Module - @nuxtjs/axios

Installation

  1. Download or clone the devless.js lib into the plugins directory of your nuxt application
  2. Open nuxt.config.js and include the lib in the plugin section. Read more on how to add plugins here
  3. Install the Nuxt Axios Module @nuxtjs/axios
  4. Add axios config to the nuxt.config.js. Recommend to proxy all requests.
axios: {
  proxy: true,
  https: true,
  retry: {
    retries: 3
  }
},
proxy: {
  '/api/v1/': {
    target: 'https://kpela.herokuapp.com/',
    changeOrigin: true
  }
}
  1. Login into your DevLess instance, head to the App section to grab the instance details to config the nuxt app (nuxt.config.js) Add the details to devless under the env key. Read more
env: {
  devless: {
    proxy: true, // When set to `true` would use the proxy url for all requests(ssr) but `false` would use the absolute path for the DevLess instance
    host: 'YOUR_DEVLESS_URL',
    'devless-token': 'YOUR_DEVLESS_TOKEN',
  }
}
  1. Restart the dev server

Usage

Refer to JS Library for more options

  1. Query Data
this.$devless.queryData('service_name', 'table_name', extras_params)
  .then(res => console.log(res))
  .catch(e => console.log(e))

The extras_params can be ignored if not available. 2. Add Data

let data = {
  name: 'Tsatsu'
}
this.$devless.addData('service_name', 'table_name', data)
  .then(res => console.log(res))
  .catch(e => console.log(e))
  1. Update Data
let data = {
  name: 'Tsatsu'
}
this.$devless.updateData('service_name', 'table_name', 'identifier', 'value', data)
  .then(res => console.log(res))
  .catch(e => console.log(e))
  1. Delete Data
this.$devless.updateData('service_name', 'table_name', 'identifier', 'value')
  .then(res => console.log(res))
  .catch(e => console.log(e))
  1. Method Calls
let params = []
this.$devless.call('service_name', 'method_name', params)
  .then(res => console.log(res))
  .catch(e => console.log(e))

params can be ignored if not available 6. Login

let payload = {
  email: '[email protected]'
  password: '******'
}
this.$devless.login(payload)
  .then(res => console.log(res))
  .catch(e => console.log(e))
  1. Register
let payload = {
  first_name: 'John',
  last_name: 'Doe',
  phone_number: '233201234567',
  email: '[email protected]'
  password: '******'
}
this.$devless.register(payload)
  .then(res => console.log(res))
  .catch(e => console.log(e))
  1. Logout
let token = 'LOGGED_IN_USER_TOKEN'
this.$devless.logout(token)
  .then(res => console.log(res))
  .catch(e => console.log(e))

Contribution

Submit PRs. Test & Improvements needed.

E-mail: [email protected]

nuxt-devless's People

Contributors

paynegreen avatar

Watchers

 avatar  avatar

Forkers

d-e-f-e-a-t

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.