Skip to content

Commit 36acb9e

Browse files
Merge pull request #1 from TG1999/master
basic structure of project
2 parents cbc8339 + f884fb5 commit 36acb9e

File tree

8 files changed

+161
-0
lines changed

8 files changed

+161
-0
lines changed

.gitignore

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
### Node ###
2+
# Logs
3+
logs
4+
*.log
5+
npm-debug.log*
6+
yarn-debug.log*
7+
yarn-error.log*
8+
9+
# Runtime data
10+
pids
11+
*.pid
12+
*.seed
13+
*.pid.lock
14+
15+
# Directory for instrumented libs generated by jscoverage/JSCover
16+
lib-cov
17+
18+
# Coverage directory used by tools like istanbul
19+
coverage
20+
21+
# nyc test coverage
22+
.nyc_output
23+
24+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
25+
.grunt
26+
27+
# Bower dependency directory (https://bower.io/)
28+
bower_components
29+
30+
# node-waf configuration
31+
.lock-wscript
32+
33+
# Compiled binary addons (https://nodejs.org/api/addons.html)
34+
build/Release
35+
36+
# Dependency directories
37+
node_modules/
38+
jspm_packages/
39+
package-lock.json
40+
41+
# TypeScript v1 declaration files
42+
typings/
43+
44+
# Optional npm cache directory
45+
.npm
46+
47+
# Optional eslint cache
48+
.eslintcache
49+
50+
# Optional REPL history
51+
.node_repl_history
52+
53+
# Output of 'npm pack'
54+
*.tgz
55+
56+
# Yarn Integrity file
57+
.yarn-integrity
58+
59+
# dotenv environment variables file
60+
.env
61+
62+
# parcel-bundler cache (https://parceljs.org/)
63+
.cache
64+
65+
# next.js build output
66+
.next
67+
68+
# nuxt.js build output
69+
.nuxt
70+
71+
# vuepress build output
72+
.vuepress/dist
73+
74+
# Serverless directories
75+
.serverless
76+
77+
# FuseBox cache
78+
.fusebox/
79+
80+
# Config files
81+
credential.js
82+
secret.js

config/credentials.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports={
2+
database:"mongodb://localhost:27017"
3+
}

controller/details.js

Whitespace-only changes.

jobs/everyweek.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var schedule = require('node-schedule');
2+
colorsequence=['maroon','dark red','red','green']
3+
expression='* 0 0 ? * MON *'
4+
var everymonday = schedule.scheduleJob(expression, function(){
5+
//QUERY FOR GITHUB API THIS WILL GIVE RESPONSE FOR EACH USER IT WILL GIVE RESPONSE
6+
//FOR EACH USER ID RESPONSE WILL BE IN TERM OF A FLAG
7+
//expression for every second '* * * ? * *' you can test the code with it
8+
console.log('Job running sucessfully')
9+
});
10+
module.exports=everymonday

models/user.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var mongoose=require('mongoose');
2+
var schema=mongoose.Schema;
3+
var user=new schema({
4+
name:{
5+
type:String
6+
},
7+
githubID:{
8+
type:String
9+
},
10+
badgecolor:{
11+
type:String,
12+
default:'green'
13+
}
14+
})
15+
const user=mongoose.model('user',user);
16+
module.exports=user

package.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "codebadge",
3+
"version": "1.0.0",
4+
"description": "Community sustainer",
5+
"main": "server.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"start": "node server.js"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/TG1999/Codebadge.git"
13+
},
14+
"keywords": [
15+
"community",
16+
"badge"
17+
],
18+
"author": "TG",
19+
"license": "MIT",
20+
"bugs": {
21+
"url": "https://github.com/TG1999/Codebadge/issues"
22+
},
23+
"homepage": "https://github.com/TG1999/Codebadge#readme",
24+
"dependencies": {
25+
"express": "^4.16.4",
26+
"mongoose": "^5.4.22",
27+
"node-schedule": "^1.3.2"
28+
}
29+
}

routes/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const express=require('express')
2+
const router=express.Router()
3+
router.get('/test',(req,res)=>{
4+
res.send('working sucessfully')
5+
})
6+
module.exports=router

server.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const express=require('express')
2+
const mongoose=require('mongoose')
3+
const app = express()
4+
const route=require('./routes')
5+
const secret = require('./config/credentials.js');
6+
const jobs=require('./jobs/everyweek')
7+
app.use(express.urlencoded({extended:true}))
8+
app.use(express.json())
9+
mongoose.connect(secret.database,{ useNewUrlParser: true },function() {
10+
console.log('database connected');
11+
});
12+
const PORT=process.env.PORT||3000;
13+
jobs.everymonday
14+
app.use(route)
15+
app.listen(PORT)

0 commit comments

Comments
 (0)