Giter Club home page Giter Club logo

attiv's Introduction

Attiv Node Framework

Conditions to follow this tutorial

For this tutorial to work, it is necessary to already have a pre-installed, configured mysql database and a created database.

In addition, it is necessary to have the npm and node installed in the latest versions

Installation

1 - Clone or repository

2 - Access the project you finished and clone

2.1 - Change the package.json by adding the following content only to test the example

"_moduleAliases": {
   "attiv": "./framework"
},

3 - Execute the following commands in the root directory of the application

npm install
npm run postinstall

In this step the framework is already configured and now it is already possible to reference your files using the alias vitta-api

4 - Access the example directory and execute the commands below

npm install

5 - Change the name of the .env.example file to.env

6 - Change the database settings in .env

7 - Execute the following commands to create the tables in mysql

node_modules/.bin/sequelize db:migrate
  • If any errors occur in this step, review the configuration of the database

8 - Now run the npm run dev command to run the application, if everything went well your api is in the air, using the Vitta framework.

attiv's People

Contributors

elvisley avatar leonardosouza97 avatar lucasviniciusnunes avatar pablovieiras avatar rlrezende avatar taciomedeiros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

attiv's Issues

Update project version at release

The number version of project is incremented only in npm repository, but the source code isn't updated. When a new version is released, the package.json version must be updated too.

image

image

The 'API' router is not accessible

Is your feature request related to a problem? Please describe.

In file attiv/framework/application/routes/index.ts we can see that is a router called API that wasn't exposed, and only a health check route is defined, but this wasn't exposed

Describe the solution you'd like
My solution is to define the healthcheck route in the main router and don't expose api subgroup.

Describe alternatives you've considered
None.

Additional context
None.

Implementing Link Header Pagination

In the past few years, more and more APIs have begun to follow the RFC5988 convention of using the Link header to provide URLs for the next page.

An API that uses the Link header can return a set of ready-made links so the API consumer doesn't have to construct links themselves. This is especially important when pagination is cursor based. Here is an example of a Link header used properly, grabbed from GitHub's documentation:

Link: https://api.github.com/user/repos?page=3&per_page=100; rel="next",
https://api.github.com/user/repos?page=50&per_page=100; rel="last"

next - shows the URL of the immediate next page of results.
last - shows the URL of the last page of results.
first - shows the URL of the first page of results.
prev - shows the URL of the immediate previous page of results.

The response includes also additional information about pagination like total entries and total pages.

Example headers:

X-Total-Entries: 60
X-Total-Pages: 2

Multiple interfaces outside attiv scope are needed to create a project

Is your feature request related to a problem? Please describe.
Today to start a new attiv project we use a few interfaces that had to be imported direct from dependencies. This couldn't be interesting if we can create a decoupled framework.

Ex:.
const { asClass, asValue } = require('awilix');

Describe the solution you'd like

Create and export in attiv interfaces and functions that implements the requirements from awillix and express

Describe alternatives you've considered
None

Setup Unit Tests for the framework

Is your feature request related to a problem? Please describe.
Setup a unit tests runner for testing the framework folder

Describe the solution you'd like
Setup a unit tests runner with mocha or jest

Describe alternatives you've considered
None.

Additional context
None.

I can't create an API that don't need database

Is your feature request related to a problem? Please describe.

Because of the content of file attiv/framework/application/middlewares/responseHandler.ts i need to put a DBContext on the container otherwise the framework breaks when answer through the handler

Describe the solution you'd like
Involve the call of container.resolve() with a try catch block and check if the Object is null/undefined in the function

Describe alternatives you've considered

  • Verify if awillix have a tryResolve function

Additional context
None.

Setup unit tests and integration tests for the example

Is your feature request related to a problem? Please describe.
Setup a unit tests runner for testing the example folder

Describe the solution you'd like
Setup a unit tests runner with mocha or jest

Describe alternatives you've considered
None.

Additional context
None.

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.