Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mateusfg7/bethehero-backend
:earth_americas: Back-end da aplicação 'Be The Hero', feita na Semana Omnistack 11 da Rocketseat, com Node JS.
https://github.com/mateusfg7/bethehero-backend
api-rest backend be-the-hero database express javascript knex node nodejs nodemon omnistack omnistack-week-11 rocketseat sqlite3
Last synced: 17 days ago
JSON representation
:earth_americas: Back-end da aplicação 'Be The Hero', feita na Semana Omnistack 11 da Rocketseat, com Node JS.
- Host: GitHub
- URL: https://github.com/mateusfg7/bethehero-backend
- Owner: mateusfg7
- Created: 2020-03-23T19:29:28.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-20T20:40:55.000Z (over 4 years ago)
- Last Synced: 2024-10-15T21:21:39.495Z (2 months ago)
- Topics: api-rest, backend, be-the-hero, database, express, javascript, knex, node, nodejs, nodemon, omnistack, omnistack-week-11, rocketseat, sqlite3
- Language: JavaScript
- Homepage: https://rocketseat.com.br/
- Size: 145 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![Be The Hero](doc/logo.svg)
[![BACK-END](https://img.shields.io/badge/NodeJS-green?logo=Node.js&logoColor=green&label=BackEnd&labelColor=black&style=flat-square)](https://github.com/mateusfg7/BeTheHero-Backend)
[![FRONT-END](https://img.shields.io/badge/ReactJS-blue?logo=React&logoColor=blue&label=FrontEnd&labelColor=black&style=flat-square)](https://github.com/mateusfg7/BeTheHero-Frontend)
[![MOBILE](https://img.shields.io/badge/ReactNative-9cf?logo=React&logoColor=9cf&label=Mobile&labelColor=black&style=flat-square)](https://github.com/mateusfg7/BeTheHero-Mobile)
Be The Hero (Seja um herói) é uma aplicação que conecta pessoas que tem vontade de ajudar ONGS doando um valor para tratar algum caso específico.
_Back-end da aplicação, feita na **Semana OmniStack 11** da **Rocketseat**_
_(23/03/20 a 27/03/20)_
[TO-DO + Anotações](https://github.com/users/mateusfg7/projects/4)
© [Rocketseat](https://rocketseat.com.br/)
Instrutor: [Diego Fernandes](https://github.com/diego3g)
---
**App feito com [Node JS]()**
## Instalar dependências
```bash
npm install
```
## Iniciar knex com o arquivo de configuração do banco de dados
```bash
npx knex init
```
### Arquivo de configuração **knexfile.js**
```JS
// Update with your config settings.module.exports = {
development: {
client: 'sqlite3',
connection: {
filename: './src/database/db.sqlite'
},
migrations: {
directory: './src/database/migrations'
},
useNullAsDefault: true,
},
test: {
client: 'sqlite3',
connection: {
filename: './src/database/test.sqlite'
},
migrations: {
directory: './src/database/migrations'
},
useNullAsDefault: true,
},staging: {
client: 'postgresql',
connection: {
database: 'my_db',
user: 'username',
password: 'password'
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
},production: {
client: 'postgresql',
connection: {
database: 'my_db',
user: 'username',
password: 'password'
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
}};
```
## Criar Database
```bash
npx knex migrate:latest
```
## Iniciar Servidor
```bash
npm start
```
## Estrutura- `tests/` -> pasta com tetes automatisados
- `tests/unit` -> pasta com tetes unitários
- `tests/Integration` -> pasta com tetes de rotas
- `src/app.js` -> arquivo principal
- `src/routes.js` -> arquivo de rotas
- `src/server.js` -> arquivo para ativar servidor
- `src/utils` -> funções úteis
- `src/database` -> arquivos de configuração e conexão com o banco de dados