├── README.md
├── index.js
├── app.js
├── database
└── database.js
├── package.json
├── .devcontainer
└── devcontainer.json
└── .gitignore
/README.md:
--------------------------------------------------------------------------------
1 | # codespace-auth-22
2 | An auth system totally designed in github codespace
3 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | const app = require('./app')
2 | const {PORT} = process.env
3 | app.listen(PORT, () => {
4 | console.log(`SERVER is running at port: ${PORT}`);
5 | })
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | require('dotenv').config()
2 | const express = require('express')
3 |
4 | const app = express()
5 |
6 | app.get("/", (req, res) => {
7 | res.send("
Server is working
")
8 | })
9 |
10 |
11 | module.exports = app
--------------------------------------------------------------------------------
/database/database.js:
--------------------------------------------------------------------------------
1 | const mongoose = require("mongoose")
2 |
3 | const MONGODB_URL = process.env
4 |
5 | exports.connect = () => {
6 | mongoose.connect(MONGODB_URL, {
7 | useNewUrlParser: true,
8 | useUnifiedTopology: true
9 | })
10 | .then()
11 | .catch((error) => {
12 | console.log(`DB connection FAILED`);
13 | console.log(error);
14 | process.exit(1)
15 | })
16 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "codespace-auth-22",
3 | "version": "1.0.0",
4 | "description": "An auth system totally designed in github codespace",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "node index.js"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git+https://github.com/hiteshchoudhary/codespace-auth-22.git"
12 | },
13 | "keywords": [],
14 | "author": "",
15 | "license": "ISC",
16 | "bugs": {
17 | "url": "https://github.com/hiteshchoudhary/codespace-auth-22/issues"
18 | },
19 | "homepage": "https://github.com/hiteshchoudhary/codespace-auth-22#readme",
20 | "dependencies": {
21 | "bcryptjs": "^2.4.3",
22 | "cookie-parser": "^1.4.6",
23 | "dotenv": "^16.0.3",
24 | "express": "^4.18.2",
25 | "jsonwebtoken": "^8.5.1",
26 | "mongoose": "^6.7.2"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Node.js",
3 | "image": "mcr.microsoft.com/devcontainers/javascript-node:16-bullseye",
4 | "features": {
5 | "ghcr.io/devcontainers/features/docker-from-docker:1": {}
6 | },
7 |
8 | // Features to add to the dev container. More info: https://containers.dev/implementors/features.
9 | // "features": {},
10 |
11 | // Use 'forwardPorts' to make a list of ports inside the container available locally.
12 | "forwardPorts": [4000],
13 |
14 | // Use 'postCreateCommand' to run commands after the container is created.
15 | "postCreateCommand": "npm install",
16 |
17 | // Configure tool-specific properties.
18 | "customizations": {
19 | "vscode": {
20 | "extensions": [
21 | "esbenp.prettier-vscode",
22 | "rangav.vscode-thunder-client"
23 | ],
24 | "settings": {
25 | "editor.fontSize": 32,
26 | "terminal.integrated.fontSize": 24
27 | }
28 |
29 | }
30 |
31 | }
32 |
33 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
34 | // "remoteUser": "root"
35 | }
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 |
9 | # Diagnostic reports (https://nodejs.org/api/report.html)
10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11 |
12 | # Runtime data
13 | pids
14 | *.pid
15 | *.seed
16 | *.pid.lock
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 | *.lcov
24 |
25 | # nyc test coverage
26 | .nyc_output
27 |
28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29 | .grunt
30 |
31 | # Bower dependency directory (https://bower.io/)
32 | bower_components
33 |
34 | # node-waf configuration
35 | .lock-wscript
36 |
37 | # Compiled binary addons (https://nodejs.org/api/addons.html)
38 | build/Release
39 |
40 | # Dependency directories
41 | node_modules/
42 | jspm_packages/
43 |
44 | # TypeScript v1 declaration files
45 | typings/
46 |
47 | # TypeScript cache
48 | *.tsbuildinfo
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Microbundle cache
57 | .rpt2_cache/
58 | .rts2_cache_cjs/
59 | .rts2_cache_es/
60 | .rts2_cache_umd/
61 |
62 | # Optional REPL history
63 | .node_repl_history
64 |
65 | # Output of 'npm pack'
66 | *.tgz
67 |
68 | # Yarn Integrity file
69 | .yarn-integrity
70 |
71 | # dotenv environment variables file
72 | .env
73 | .env.test
74 |
75 | # parcel-bundler cache (https://parceljs.org/)
76 | .cache
77 |
78 | # Next.js build output
79 | .next
80 |
81 | # Nuxt.js build / generate output
82 | .nuxt
83 | dist
84 |
85 | # Gatsby files
86 | .cache/
87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js
88 | # https://nextjs.org/blog/next-9-1#public-directory-support
89 | # public
90 |
91 | # vuepress build output
92 | .vuepress/dist
93 |
94 | # Serverless directories
95 | .serverless/
96 |
97 | # FuseBox cache
98 | .fusebox/
99 |
100 | # DynamoDB Local files
101 | .dynamodb/
102 |
103 | # TernJS port file
104 | .tern-port
105 |
--------------------------------------------------------------------------------