This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ⭐ Total Stars: 13 | |
| ➕ Total Commits: 847 | |
| 🔀 Total PRs: 215 | |
| 🚩 Total Issues: 296 | |
| 📦 Contributed to: 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 🌞 Morning 49 commits ██▎░░░░░░░░░░░░░░░░░░ 10.7% | |
| 🌆 Daytime 110 commits █████░░░░░░░░░░░░░░░░ 24.1% | |
| 🌃 Evening 180 commits ████████▎░░░░░░░░░░░░ 39.4% | |
| 🌙 Night 118 commits █████▍░░░░░░░░░░░░░░░ 25.8% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require("express"); | |
| const router = express.Router(); | |
| const postController = require("../controllers/post"); | |
| router.post("/", postController.textUpload); | |
| router.get("/hashtag", postController.hashtagSearch); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends layout | |
| block content | |
| if user | |
| .twits | |
| form#hashtag-form(action='/post/hashtag') | |
| input(type='text' name='hashtag' placeholder='Tag Search') | |
| button.btn Search | |
| form#sns-form(action='/post' method='POST' enctype='multipart/form-data') | |
| .sns-discription post content |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { Post, Hashtag } = require("../models"); | |
| exports.textUpload = async (req, res, next) => { | |
| try { | |
| const post = await Post.create({ | |
| content: req.body.content, | |
| img: req.body.url, | |
| userId: req.user.id, | |
| }); | |
| const hashtags = req.body.content.match(/#[^\s#]*/g); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = (sequelize, DataTypes) => | |
| (sequelize.define( | |
| "post", | |
| { | |
| content: { | |
| type: DataTypes.STRING(140), | |
| allowNull: false, | |
| }, | |
| img: { | |
| type: DataTypes.STRING(200), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = (sequelize, DataTypes) => | |
| sequelize.define( | |
| "hashtag", | |
| { | |
| title: { | |
| type: DataTypes.STRING(15), | |
| allowNull: false, | |
| unique: true, | |
| }, | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Sequelize = require("sequelize"); | |
| const env = process.env.NODE_ENV || "development"; | |
| const config = require("../config/config.json")[env]; | |
| const db = {}; | |
| const sequelize = new Sequelize( | |
| config.database, | |
| config.username, | |
| config.password, | |
| config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "development": { | |
| "username": "username", | |
| "password": "password", | |
| "database": "sns", | |
| "host": "127.0.0.1", | |
| "dialect": "mysql" | |
| }, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require("path"); | |
| const express = require("express"); | |
| const bodyParser = require("body-parser"); | |
| const cookieParser = require("cookie-parser"); | |
| const morgan = require("morgan"); | |
| const flash = require("connect-flash"); // req.flash() requires sessions | |
| require("dotenv").config(); | |
| const { sequelize } = require("./models"); // ./models === ./passport/(index.js) |