servidio

1.3.0 • Public • Published

Servidio

NPM Version

JavaScript Frontend Services

GitHub Last Commit NPM Downloads

Codacy Badge Maintainability

GitHub Top Language Code Size

Overview

Servidio is a JavaScript Frontend Service Library.
You will find some Services about Checkers, Data, Getters & Setters.
Data Services are using Axios.

Summary

Servidio
Overview
Summary
Package
Download
CDN
Content
Usage for Vue3 + NPM


Package (recommended)

NPM : npm i servidio
or
Yarn : yarn add servidio


Download

Latest Release
or
git clone https://github.com/philippebeck/servidio.git
or
Master ZIP


CDN (not recommanded)

Warning about the CDN: if you want to use the axios functions or checker functions from packages (email, password or url), you need to import them by yourself & before servidio


Content

Checker part :

  • checkEmail(email) : check email validity
  • checkError(error) : check error response
  • checkLikes(usersLiked) check likes from array of user ids
  • checkNumber(number, min, max) : check number min/max
  • checkPass(pass) : check password validity
  • checkRole(userRole, role) check role between admin, editor or user
  • checkString(string, min, max) : check string min/max
  • checkUrl(url) : check url validity

Data part :

  • getData(url) get data with axios
  • postData(url, data) post data with axios
  • patchData(url, data) patch data with axios
  • putData(url, data) put data with axios
  • deleteData(url) delete data with axios

Getter part :

  • getAverage(id, array) get average from product score
  • getCats(items) get categories from an array of objects
  • getItemName(id, items) get image name
  • getItemsByCat(items) get items by category property

Setter part :

  • setGlobalMeta(lang, creator) set html lang & meta creator for tw
  • setTitle(title) set head title & title for og/tw
  • setDescription(description) set meta description & description for og/tw
  • setUrl(url) set canonical & url/site for og/tw
  • setImage(image) set image for og & tw
  • setMeta(title, description, url, image) set all meta for pages

Usage for Vue3 + NPM

  1. Copy the servidio/constants.js file to your project root like this : /constants.js & replace values with your own values
  2. In main.js of Vue3, import servidio like this : import serve from "servidio"
  3. Then, add this line after creating App but before mounting : app.config.globalProperties.$serve = serve (example)
  4. Then use it in yours components like in these examples :
    • this.$serve.getData(url) (example)
    • this.$serve.postData(url, data)
    • this.$serve.checkEmail(message.email) (example)
    • this.$serve.checkPass(user.pass)

Install

npm i servidio

DownloadsWeekly Downloads

145

Version

1.3.0

License

Apache-2.0 License

Unpacked Size

40.3 kB

Total Files

13

Last publish

Collaborators

  • philippebeck