Servidio
JavaScript Frontend Services
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
- Development : https://cdn.jsdelivr.net/npm/servidio@1.3.0/dist/serve.js
- Production : https://cdn.jsdelivr.net/npm/servidio@1.3.0/dist/serve.min.js
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
- Copy the
servidio/constants.js
file to your project root like this :/constants.js
& replace values with your own values - In
main.js
of Vue3, importservidio
like this :import serve from "servidio"
- Then, add this line after creating App but before mounting :
app.config.globalProperties.$serve = serve
(example) - Then use it in yours components like in these examples :