JS Projects and Databases

class Model {
class Product extends Model{}
class ItemRequirement extends Model{}
class Model {
async post(){}
async save(){}
async destroy(){}
static async retrieve(){}
async post(include){
//Sends a POST request to the server
const c = this.constructor const url = c.root + c.resource const options = { method: 'POST', headers: {...c.headers}, body: JSON.stringify(packageBody(this, include)) } const response = await fetch(url, options) const obj = await fromJson(response) c.buildRelationships(obj) return c.addInstance(obj.data)}
class Product extends Model{  static resource = "products/"  static instances = []}
class Item extends Model{ static resource = "items/" static instances = []}class ItemCodeParameter extends Model { static resource = "item_code_parameters/" static instances = []}

In conclusion




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Using react-webcam in a function component

5 most important topics of JavaScript you should definitely know

React Native — The things that you should be aware of before coming onboard

Lands of Fire build 5.5

How a Popular Feature Declined by Svelte Went Live in Malina.js

Learn about Es6.

Some advanced topics(Es6 features) of JavaScript.

Early challenge here

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nate Nelson

Nate Nelson

More from Medium

REACT HOOK(useState and useEffect)

React Node Jwt Authentication without Redux — using LocalStorage and Axios

Voice Effects using Pizzicato.js with Agora RTC in a React JS App

Uploading Images with Rails API and React