0.0.45 • Published 4 years ago

glia v0.0.45

Weekly downloads
101
License
-
Repository
-
Last release
4 years ago

Glia

Lightweight Microservice Framework

npm (scoped)

codecov

lets see how far I can make it

All you should care at the end of the day is your business logic

Getting started in 4 simple steps

Configure your service

Database \ Paths for Logs/Validation/Sanitization/Configs (Althought default values are available)

Setup routing

const timeZones = {
    paramExpected: "", // param being passed with url
    batch: "LoadTimeZones", // service function to be called
    routeType: "internal", // how service is exposed internal || external
};

const routes = {
    "/v1/time-zones": timeZones, // each endpoint can be versioned, by default all enpoints use v1
}

Define service - Business Logic

all passed params will be available within data object

LoadTimeZones: async (data) => {
    let timeZones timeZones = await getModel.GetTimeZones(data);
    return timeZones;
}

Define model - ( RAW || Sequelizer )

Raw MySQL access example

GetTimeZones: async function (data) {

    const q = `SELECT * FROM time_zone WHERE active = 1`;

    const conn = await getConnection();
    const result = (await conn.query(q))[0];
    conn.release();

    if (result.length < 1)
      throw new DbError(
        "Time zone table does not contain any data",
        "GetTimeZones"
      );

    return result;

}

List of features:

  • Pure JavaScript control over the BusinessLogic - you get input and you return output
  • DB Layer - Sequelizer, Raw Queries(to support what Sequelizer struggles to do)
  • Custom sanitizer provider with an option to override
  • @hapi/joi fields validator with an option to plug your own
  • Nested error handling. Option to customize response override
  • Easy service pathnames processing
0.0.45

4 years ago

0.0.44

4 years ago

0.0.43

4 years ago

0.0.42

4 years ago

0.0.41

4 years ago

0.0.40

4 years ago

0.0.37

4 years ago

0.0.38

4 years ago

0.0.39

4 years ago

0.0.36

4 years ago

0.0.35

4 years ago

0.0.34

4 years ago

0.0.33

4 years ago

0.0.30

4 years ago

0.0.31

4 years ago

0.0.28

4 years ago

0.0.29

4 years ago

0.0.25

4 years ago

0.0.26

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.21

4 years ago

0.0.22

4 years ago

0.0.18

4 years ago

0.0.19

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago