Giter Site home page Giter Site logo

sequelize_homestash's Introduction

HomeStash Backend

Sequelize and Express server backend for HomeStash app, developed in Node.JS using ExpressJS and Sequelize.

Available Scripts

In the project directory, you can run:

node index.js

Runs the server in the 3002 port.
You could use any HTTP request manager such as Postman to query the server. Any edits in the code will not reload the server, you should install a package such as nodemon to update changes when saving.

npm install nodemon

Technologies

HomeStash Backend uses a number of open source projects to work properly:

  • NodeJs
  • ExpressJS
  • Sequelize

You should also connect Sequelize to a MySQL instance. For this project, I used XAMPP to create a MySQL and an Apache instance to manage the database.

Installation

HomeStash Backend requires Node.js v8+ to run.

Install the dependencies and devDependencies and start the server.

cd sequelize_homestash

npm install -d

To run the project

HomeStash Backend will listen on port 3002, but you can change it with a "PORT" environment variable.

API

Get stash data:

GET /home

Response: { "stashData": [ { "id": "090877ac-5ebb-427d-85bf-391636c352b0", "name": "bathroom", "createdById": "1", "createdAt": "2019-02-06T19:53:20.000Z", "updatedAt": "2019-02-06T19:53:20.000Z", "items": [ { "id": "d4c15959-45d1-4176-80be-fe4a4588b534", "name": "Toilet cleaner", "quantityAmount": 2, "quantityType": "units", "estimatedDurability": "2019-03-14T00:00:00.000Z", "purchaseDate": "2019-02-14T00:00:00.000Z", "createdAt": "2019-02-14T17:43:00.000Z", "updatedAt": "2019-02-14T17:43:00.000Z", "stashId": "090877ac-5ebb-427d-85bf-391636c352b0" } ] }, ] }

GET /:stashId

Response:

{ "stashData": { "id": "090877ac-5ebb-427d-85bf-391636c352b0", "name": "bathroom", "createdById": "1", "createdAt": "2019-02-06T19:53:20.000Z", "updatedAt": "2019-02-06T19:53:20.000Z" } }

GET /:stashId/items

Response:

{ "itemsData": [ { "id": "d4c15959-45d1-4176-80be-fe4a4588b534", "name": "Toilet cleaner", "quantityAmount": 2, "quantityType": "units", "estimatedDurability": "2019-03-14T00:00:00.000Z", "purchaseDate": "2019-02-14T00:00:00.000Z", "createdAt": "2019-02-14T17:43:00.000Z", "updatedAt": "2019-02-14T17:43:00.000Z", "stashId": "090877ac-5ebb-427d-85bf-391636c352b0" } ] }

POST /:stashId/items

Required: name, quantityAmount, quantityType, estimatedDurability, purchaseDate.

sequelize_homestash's People

Contributors

njdiazsoler avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.