Skip to content

Commit

Permalink
Merge branch 'frontend' into Hub
Browse files Browse the repository at this point in the history
  • Loading branch information
dkstlzu committed Oct 26, 2020
2 parents 9abe9db + c964d6b commit 8f2cfe6
Show file tree
Hide file tree
Showing 3,042 changed files with 509,876 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Binary file added DB/로그인_+_커뮤니티_DB_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added Lawbot_web/.gitkeep
Empty file.
Binary file added React/.DS_Store
Binary file not shown.
185 changes: 185 additions & 0 deletions React/Backend/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
const Sequelize = require('sequelize');
const sequelize2= new Sequelize(
'ict',
'admin',
'48834883',
{
'host' : 'ict.cor8kkyfcogd.ap-northeast-2.rds.amazonaws.com',
'dialect' : 'mysql'
}
);
const sequelize = new Sequelize(
'ICT', // database name
'yoonseok', // id
'12341234', // pw
{
'host': 'localhost', // host
'dialect': 'mariadb' // db type
}
);
const user2=sequelize2.define('User', {
ID: {
type: Sequelize.INTEGER,
primaryKey: true
},
userID: {
type: Sequelize.STRING
},
userPW: {
type: Sequelize.STRING
},
email: {
type: Sequelize.STRING
},
name:
{
type: Sequelize.STRING
},
birth:
{
type:Sequelize.DATE
},
gender:
{
type:Sequelize.INTEGER
},
isLawyer:
{
type:Sequelize.INTEGER
}
},{freezeTableName: true,timestamps: false});
const post=sequelize.define('post',{
postID: {
type: Sequelize.INTEGER,
primaryKey: true
},
userID: {
type: Sequelize.INTEGER
},
boardCategory: {
type: Sequelize.INTEGER
},
title: {
type: Sequelize.STRING
},
content:
{
type: Sequelize.STRING
},
writtenDate:
{
type: Sequelize.DATE
}
},{freezeTableName: true,timestamps: false});


const user=sequelize.define('user', {
ID: {
type: Sequelize.INTEGER,
primaryKey: true
},
userID: {
type: Sequelize.STRING
},
userPW: {
type: Sequelize.STRING
},
email: {
type: Sequelize.STRING
},
name:
{
type: Sequelize.STRING
},
birth:
{
type:Sequelize.DATE
},
gender:
{
type:Sequelize.INTEGER
},
isLawyer:
{
type:Sequelize.INTEGER
}
},{freezeTableName: true,timestamps: false});

const express = require('express');
const app = express();
//app.use(express.urlencoded());
app.use(express.json());
app.use(require('cors')());
app.get('/user/:id',(req,res) => {
user.findOne({
where : {ID: req.params.id}
}).then((data) =>{
res.json(data);
})})
app.post('/user/register',(req,res) => {
user.create(req.body).then( result => {
res.json({success:true});
})
.catch( err => {
res.json({success: false});
})
});
app.get('/boards/posts',(req,res)=>{
// console.log("hi");
post.findAll()
.then((data) => {
//console.log(data);
res.json(data);
}
)
});
app.get('/boards/:id',(req,res)=>{
console.log(req.params.id);
post.findOne({
where: {postID:req.params.id}
}).then(result=>{
res.json(result);
})
})
app.post('/boards/write',(req,res) => {
post.create(req.body).then( result => {
res.json({success:true});
})
.catch( err => {
res.json({success: false});
})
});
app.delete('/boards/:id',(req,res) =>{
post.destroy({
where : {postID : req.params.id}
}).then(
console.log("Hi")
)
res.json({success:true});
})
app.post('/user/login', (req, res) => {
user.findOne({
where: { userID: req.body.userID }
})
.then((user) => {
console.log(user.dataValues);
if (user===null)
{
res.json({success:false});
}
else
{
if (user.dataValues.userPW==req.body.userPW)
{
res.json({success:true,id:user.dataValues.ID});
}
else
{
res.json({success:false});
}
}

});
});

app.listen(8080);
1 change: 1 addition & 0 deletions React/Backend/node_modules/.bin/cdl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions React/Backend/node_modules/.bin/esparse

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions React/Backend/node_modules/.bin/esvalidate

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions React/Backend/node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions React/Backend/node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions React/Backend/node_modules/.bin/uuid

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions React/Backend/node_modules/@types/geojson/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions React/Backend/node_modules/@types/geojson/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8f2cfe6

Please sign in to comment.