Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vinnydeveloper/fake_instagram
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: sergiomoura/fake_instagram
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 12 commits
  • 18 files changed
  • 1 contributor

Commits on Apr 26, 2020

  1. Instalado o nodemon

    sergiomoura committed Apr 26, 2020
    Copy the full SHA
    49ea986 View commit details
  2. Copy the full SHA
    e709c32 View commit details
  3. Organizando routers

    sergiomoura committed Apr 26, 2020
    Copy the full SHA
    c871301 View commit details
  4. Copy the full SHA
    5ed5de6 View commit details
  5. Copy the full SHA
    c3c189f View commit details
  6. Copy the full SHA
    e8345c8 View commit details
  7. Copy the full SHA
    fe67115 View commit details
  8. Copy the full SHA
    165ae0b View commit details

Commits on Apr 27, 2020

  1. Bugfix no index.ejs

    sergiomoura committed Apr 27, 2020
    Copy the full SHA
    e0e0af4 View commit details
  2. Copy the full SHA
    1a16936 View commit details
  3. Copy the full SHA
    d56477b View commit details
  4. Copy the full SHA
    f73e1a2 View commit details
5 changes: 5 additions & 0 deletions .env.exemple
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB_USER=root
DB_PASS=
DB_NAME=instagram
DB_HOST=127.0.0.1
DB_PORT=3306
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
node_modules
roadmap.todo
.env
7 changes: 3 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
@@ -4,8 +4,7 @@ var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');

var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var IndexRouter = require('./routes/IndexRouter');

var app = express();

@@ -19,8 +18,8 @@ app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', indexRouter);
app.use('/users', usersRouter);
app.use('/', IndexRouter);


// catch 404 and forward to error handler
app.use(function(req, res, next) {
18 changes: 18 additions & 0 deletions constrollers/AuthController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const AuthController = {

showLogin: (req,res) => {
res.render('auth/login');
},

showRegistro: (req,res) => {
res.render('auth/register');
},

showHome: (req,res) => {
res.render('index');
}


}

module.exports = AuthController;
58 changes: 58 additions & 0 deletions fake_instagram.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
DROP SCHEMA if exists instagram;
CREATE SCHEMA IF NOT EXISTS instagram;
USE instagram;

CREATE TABLE usuarios (
id INT PRIMARY KEY AUTO_INCREMENT,
nome VARCHAR(100) NOT NULL,
email VARCHAR(100) NOT NULL,
senha VARCHAR (256) NOT NULL
);
CREATE TABLE posts (
id INT PRIMARY KEY AUTO_INCREMENT,
texto VARCHAR(100) NOT NULL,
img VARCHAR(100),
usuarios_id INT,
n_likes INT not null default 0,
FOREIGN KEY (usuarios_id) REFERENCES usuarios(id) ON DELETE CASCADE

);
CREATE TABLE comentarios (
id INT PRIMARY KEY AUTO_INCREMENT,
texto TEXT NOT NULL,
usuarios_id INT,
posts_id INT,
FOREIGN KEY (usuarios_id) REFERENCES usuarios(id) ON DELETE CASCADE,
FOREIGN KEY (posts_id) REFERENCES posts(id) ON DELETE CASCADE
);

-- ADICIONAR DADOS USUARIOS
INSERT INTO usuarios
(nome, email, senha)
VALUES
('Gabriel Brunetti', 'gbrunetti@digitalhouse.com', '$2b$10$hKXxuZe3vE4EBVAIdzvrxuL3OrynJQZBbRiZnEYfwrgC1A0LKsuYe'),
('Sergio Siqueira', 'ssiqueira@digitalhouse.com', '$2b$10$2/MGT6aEKBa1DlbOMPBWS.4Xhqm5k.v9g4YBzHi78jT1xQq5vE4C.'),
('Felipe Veronesi', 'fveronesi@digitalhouse.com', '$2b$10$gabZ48YuFts8C64vhE0jy.GBOUi5ZeZbzkD5O1BK0a46WNvPiOOLK'),
('Hendy Almeida', 'halmeida@digitalhouse.com', '$2b$10$iXZN2CUh2NNudnv.4k8xT.C4VviqJ4p.tqvMetObTNg3DaqliVyDO');

-- ADICIONANDO DADOS A POSTS
INSERT INTO posts
(texto, img, usuarios_id)
VALUES
('Oi gente tudo bem?', null, 1),
('Como foi o fim de semana?', null, 1);

-- ADICIONANDO DADOS A COMENTARIOS
INSERT INTO comentarios
(texto, usuarios_id,posts_id)
VALUES
('Oi! Tirando os problemas, tudo certo!',2,1),
('Oi gente é o !@#!$%! Meu nome agora é Zé Pequeno!',3,1),
('Oi pra você também,!',4,1),
('Fim de semana já não existe mais!',2,2),
('FDS nervoso!',3,2),
('Fim de semana foi lindo!',4,2);




Loading