Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
muskaanshraogi committed Nov 23, 2020
0 parents commit 81df50d
Show file tree
Hide file tree
Showing 22 changed files with 14,142 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
frontend/node_modules

backend/node_modules
backend/.env
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'

20 changes: 20 additions & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "backend",
"version": "1.0.0",
"main": "server.js",
"author": "muskaanshraogi",
"license": "MIT",
"scripts": {
"start": "nodemon server.js"
},
"dependencies": {
"body-parser": "^1.19.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"mysql": "^2.18.1",
"path": "^0.12.7"
},
"devDependencies": {
"nodemon": "^2.0.6"
}
}
29 changes: 29 additions & 0 deletions backend/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const express = require('express')
const path = require('path')
const mysql = require('mysql')
const dotenv = require('dotenv')

dotenv.config()

let app = express()

let PASSWORD = process.env.PASSWORD || ''
const connection = mysql.createConnection({
host: 'localhost',
user: process.env.USER,
password: PASSWORD,
})

connection.connect((error) => {
if(error) {
console.log(error)
}
else {
console.log('Connected to MySQL...')
}
})

const PORT = process.env.PORT || 8000
app.listen(PORT, () => {
console.log(`Server up on port ${PORT}`)
})
Loading

0 comments on commit 81df50d

Please sign in to comment.