-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f5626a7
Showing
19 changed files
with
12,602 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"watch": [ | ||
"src" | ||
], | ||
"ext": "ts", | ||
"exec": "ts-node ./src/app.ts" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"name": "tsnode", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "./src/app.ts", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"start": "sudo pm2 start src/app.ts", | ||
"stop": "sudo pm2 delete app", | ||
"db": "sudo pm2 start mongod --dbpath ./db", | ||
"dev": "cross-env nodemon ./src/app.ts", | ||
"build": "webpack --config webpack.config.js", | ||
"buildtsc": "nodemon tsc" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@types/cors": "^2.8.6", | ||
"@types/crypto-js": "^3.1.43", | ||
"@types/dotenv": "^8.2.0", | ||
"@types/mongoose": "^5.7.1", | ||
"@types/morgan": "^1.7.37", | ||
"@types/shortid": "0.0.29", | ||
"bcrypt-nodejs": "0.0.3", | ||
"compression": "^1.7.4", | ||
"cors": "^2.8.5", | ||
"cross-env": "^6.0.3", | ||
"dotenv": "^8.2.0", | ||
"express": "^4.17.1", | ||
"fs": "0.0.1-security", | ||
"helmet": "^3.21.2", | ||
"http": "^0.0.0", | ||
"jsonwebtoken": "^8.5.1", | ||
"lowdb": "^1.0.0", | ||
"mongodb": "^3.5.3", | ||
"mongoose": "^5.8.11", | ||
"morgan": "^1.9.1", | ||
"multer": "^1.4.2", | ||
"nodemailer": "^6.4.2", | ||
"path": "^0.12.7", | ||
"pm2": "^4.2.3", | ||
"shortid": "^2.2.15", | ||
"ts-lint": "^4.5.1", | ||
"ts-loader": "^6.2.1", | ||
"ts-node": "^8.6.2", | ||
"webpack": "^4.41.6", | ||
"webpack-cli": "^3.3.11" | ||
}, | ||
"devDependencies": { | ||
"@types/express": "^4.17.2", | ||
"@types/node": "^12.12.27", | ||
"nodemon": "^2.0.2", | ||
"typescript": "^3.7.5" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"apps": [ | ||
{ | ||
"name": "Test", | ||
"script": "./src/app.ts", | ||
"autorestart": true, | ||
"watch": false, | ||
"max_memory_restart": "1G", | ||
"log_file": "combined.log" | ||
} | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { model, Schema, Model, Document } from 'mongoose'; | ||
const userSchema = new Schema({ | ||
username: { | ||
type: String, | ||
required: true | ||
}, | ||
password: { | ||
type: String, | ||
required: true | ||
}, | ||
email: { | ||
type: String, | ||
required: true | ||
}, | ||
profile_image : { | ||
type: String, | ||
required:true | ||
}, | ||
userdata:{ | ||
type: Object, | ||
required:true | ||
} | ||
}); | ||
export interface UserDocument extends Document { | ||
username: string; | ||
password: string; | ||
enckey: string; | ||
email: string; | ||
profile_image : string; | ||
userdata: any; | ||
} | ||
const User: Model<UserDocument> = model('user', userSchema); | ||
export default User; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { model, Schema, Model, Document } from 'mongoose'; | ||
const commentSchema = new Schema({ | ||
post_id: { | ||
type: String, | ||
required: true | ||
}, | ||
email:{ | ||
type: String, | ||
required:true | ||
}, | ||
text:{ | ||
type: String, | ||
required:true | ||
}, | ||
time:{ | ||
type: String, | ||
required:true | ||
}, | ||
name:{ | ||
type: String, | ||
required:true | ||
} | ||
}); | ||
export interface CommentDocument extends Document { | ||
post_id: string; | ||
email: string; | ||
text: string; | ||
time: string; | ||
name: string; | ||
} | ||
const Comment: Model<CommentDocument> = model('comment', commentSchema); | ||
export default Comment; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { model, Schema, Model, Document } from 'mongoose'; | ||
const postSchema = new Schema({ | ||
data: { | ||
type: Object, | ||
required: true | ||
}, | ||
text: { | ||
type: String, | ||
required: true | ||
}, | ||
like: { | ||
type: Number, | ||
required: true | ||
}, | ||
like_users: { | ||
type: [String], | ||
required: true | ||
}, | ||
time: { | ||
type: String, | ||
required: true | ||
}, | ||
email:{ | ||
type:String, | ||
required:true | ||
}, | ||
name:{ | ||
type:String, | ||
required:true | ||
} | ||
|
||
}); | ||
export interface PostDocument extends Document { | ||
data: any; | ||
text: string; | ||
like: any; | ||
like_users: any; | ||
time : string; | ||
email: string; | ||
name:string; | ||
} | ||
const Post: Model<PostDocument> = model('post', postSchema); | ||
export default Post; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
function Send(res, status:Number, mes?:string, result?: boolean ,token?: string,userdata?:object) { | ||
res.status(status).send({result,mes,token,userdata}).end(); | ||
} | ||
export default Send; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const mongoose = require('mongoose'); | ||
require('dotenv').config(); | ||
|
||
const MONGO_URL = process.env.DB_HOST || 'mongodb://localhost:27017/sunrin'; | ||
const env = process.env.NODE_ENV || 'development'; | ||
|
||
let mongoURL: any = MONGO_URL; | ||
if (env !== 'production') mongoURL += `_${env}`; | ||
if (env === 'development') { | ||
mongoose.set('debug', true); | ||
} | ||
module.exports = () => mongoose.connect(mongoURL); |
Oops, something went wrong.