Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions __tests__/app.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +0,0 @@
import app from '../src/index';

describe('app module', () => {
test('it exists', async () => {
expect(app).toBeDefined();
});

test('it returns program name with SDGs', async () => {
const result = await app();
const sdgPos = (result || '').indexOf('SDG');
expect(sdgPos).toBeGreaterThanOrEqual(0);
});
});
106 changes: 97 additions & 9 deletions app.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,100 @@
project.name:
project.repo:
project.sdgs:
project.app.url:
project.codacy.url:
# =========================================================================
# this is a simple properties file
# meant to curate important meta data
# about what a team is building
#
# each entry should have a single value
# or a list of comma separated values
#
# this file can be filled incrementally
# since fields like app.urls (links to the deployed solutions)
# might not have been created right now, so you can leave ot blank.
#
# the file should be at the rook of a repo
# =========================================================================

project.team.members:
project.team.slackname:

project.fb.opensource:
# about the product
# =================

program.cohort:1
# name of the product
name:Team-069-Product

# what SDG goal(s) does the product solve
sdgs:17

# name (not link) of repo
repos:Team-069-Backend

# URL(s) to the deplyed
# app for the solution
# e.g frontend UI app pr backend API
app.urls:

# URL(s) to the Codacy
# dashbaord for this repo
# e.g https://app.codacy.com/gh/BuildForSDG/farmify-frontend/dashboard
codacy.urls:https://app.codacy.com/gh/BuildForSDG/Team-069-Backend/dashboard

# YES if the solution
# is solving for COVID-19
# otherwise, NO
app.forCOVID19: NO

# what industries
# does this solution
# or its problem statement fall
# under, e.g Agriculture
# pick from this list : https://www.opensecrets.org/industries/alphalist.php
app.industries:Misc Finance

# about the codebase
# ==================

# what are the major
# coding languages used
# to create the solution
code.languages:javascript

# what are the major
# frameworks and libraries
# used to create the solution
code.frameworks:React, Node

# what Facebook open source framework
# library, tool, or platform API
# is the codebase using
code.opensource.facebook:React, Jest

# If the team created something
# as a by-product of building the
# product, and that something is now
# open shource, pls list them
code.opensource.contributions:

# about the team
# ==============

# name of the team
team.name:Team-069

# github username
# of the team's TTL(s)
team.ttls:Holajuwon

# github username
# of the team's mentor(s)
team.mentors:Maxfurry

# name of the team's
# Slak channel in the
# BuildforSDG Slack
# workspace
team.slackchannel:team-069

# == DO NOT EDIT ==
# about the program
# =================
program.cohort:1
program.name:BuildforSDG
program.community:https://github.com/BuildForSDG
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@
},
"license": "MIT",
"dependencies": {
"bcrypt": "^4.0.1",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"mongoose": "^5.9.11",
"mongoose-unique-validator": "^2.0.3",
"nodemon": "^2.0.3"
},
"devDependencies": {
Expand Down
14 changes: 10 additions & 4 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable linebreak-style */
const express = require('express');

const cors = require('cors');
Expand All @@ -7,7 +8,8 @@ const mongoose = require('mongoose');
const app = express();

app.use(cors());

app.use(express.urlencoded({ extended: true }));
app.use(express.json());
require('dotenv').config();

const uri = process.env.ATLAS_URI;
Expand All @@ -18,8 +20,12 @@ const connect = mongoose.connection;

connect.once('open', () => 'connected');

app.use((req, res) => {
res.json({ message: 'your request wass successfull' });
});
const registrationRoutes = require('./routes/registration');

app.use('/auth', registrationRoutes);

// app.use((req, res) => {
// res.json({ message: 'your request wass successfull' });
// });

module.exports = app;
21 changes: 21 additions & 0 deletions src/models/registration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-disable linebreak-style */
/* eslint-disable eol-last */
/* eslint-disable function-paren-newline */
/* eslint-disable indent */
/* eslint-disable linebreak-style */
/* eslint-disable prefer-destructuring */
/* eslint-disable linebreak-style */
/* eslint-disable import/newline-after-import */
const mongoose = require('mongoose');

const Schema = mongoose.Schema;


const signupSchema = new Schema({
username: { type: String, required: true }
}
);

const Signup = mongoose.model('Signup', signupSchema);

module.exports = Signup;
20 changes: 20 additions & 0 deletions src/routes/registration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-disable linebreak-style */
/* eslint-disable padded-blocks */
/* eslint-disable eol-last */
/* eslint-disable linebreak-style */
const router = require('express').Router();

const Signup = require('../models/registration');

router.post('/add', (req, res) => {
const { username } = req.body;
console.log(username);
const newsignup = new Signup({
username
});
newsignup.save()
.then(() => res.json('user registered'))
.catch((err) => res.status(400).json({ error: err }));
});

module.exports = router;
5 changes: 4 additions & 1 deletion src/server.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable linebreak-style */
const http = require('http');

const app = require('./app');
Expand All @@ -6,4 +7,6 @@ app.set('port', process.env.PORT || 5000);

const server = http.createServer(app);

server.listen(process.env.PORT || 5000);
server.listen(process.env.PORT || 5000, ()=>{
console.log(`connected`)
});
Loading