8000 updated readme · s-k-zaman/node-express-course@dda4cf9 · GitHub
[go: up one dir, main page]

Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
john-smilga committed Sep 30, 2021
1 parent e0de048 commit dda4cf9
Show file tree
Hide file tree
Showing 13 changed files with 203 additions and 93 deletions.
38 changes: 20 additions & 18 deletions 03-task-manager/final/app.js
8000
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
const express = require('express')
const app = express()
const tasks = require('./routes/tasks')
const connectDB = require('./db/connect')
require('dotenv').config()
const notFound = require('./middleware/not-found')
const errorHandlerMiddleware = require('./middleware/error-handler')
const express = require('express');
const app = express();
const tasks = require('./routes/tasks');
const connectDB = require('./db/connect');
require('dotenv').config();
const notFound = require('./middleware/not-found');
const errorHandlerMiddleware = require('./middleware/error-handler');

// middleware

app.use(express.static('./public'))
app.use(express.json())
app.use(express.static('./public'));
app.use(express.json());

// routes

app.use('/api/v1/tasks', tasks)
app.use('/api/v1/tasks', tasks);

app.use(notFound)
app.use(errorHandlerMiddleware)
const port = process.env.PORT || 5000
app.use(notFound);
app.use(errorHandlerMiddleware);
const port = process.env.PORT || 5000;

const start = async () => {
try {
await connectDB(process.env.MONGO_URI)
app.listen(port, console.log(`Server is listening on port ${port}...`))
await connectDB(process.env.MONGO_URI);
app.listen(port, () =>
console.log(`Server is listening on port ${port}...`)
);
} catch (error) {
console.log(error)
console.log(error);
}
}
};

start()
start();
40 changes: 20 additions & 20 deletions 04-store-api/final/app.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
require('dotenv').config()
require('express-async-errors')
require('dotenv').config();
require('express-async-errors');

const express = require('express')
const app = express()
const express = require('express');
const app = express();

const connectDB = require('./db/connect')
const productsRouter = require('./routes/products')
const connectDB = require('./db/connect');
const productsRouter = require('./routes/products');

const notFoundMiddleware = require('./middleware/not-found')
const errorMiddleware = require('./middleware/error-handler')
const notFoundMiddleware = require('./middleware/not-found');
const errorMiddleware = require('./middleware/error-handler');

// middleware
app.use(express.json())
app.use(express.json());

// routes

app.get('/', (req, res) => {
res.send('<h1>Store API</h1><a href="/api/v1/products">products route</a>')
})
res.send('<h1>Store API</h1><a href="/api/v1/products">products route</a>');
});

app.use('/api/v1/products', productsRouter)
app.use('/api/v1/products', productsRouter);

// products route

app.use(notFoundMiddleware)
app.use(errorMiddleware)
app.use(notFoundMiddleware);
app.use(errorMiddleware);

const port = process.env.PORT || 3000
const port = process.env.PORT || 3000;

const start = async () => {
try {
// connectDB
await connectDB(process.env.MONGO_URI)
app.listen(port, console.log(`Server is listening port ${port}...`))
await connectDB(process.env.MONGO_URI);
app.listen(port, () => console.log(`Server is listening port ${port}...`));
} catch (error) {
console.log(error)
console.log(error);
}
}
};

start()
start();
36 changes: 19 additions & 17 deletions 05-JWT-Basics/final/app.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
require('dotenv').config()
require('express-async-errors')
require('dotenv').config();
require('express-async-errors');

const express = require('express')
const app = express()
const express = require('express');
const app = express();

const mainRouter = require('./routes/main')
const notFoundMiddleware = require('./middleware/not-found')
const errorHandlerMiddleware = require('./middleware/error-handler')
const mainRouter = require('./routes/main');
const notFoundMiddleware = require('./middleware/not-found');
const errorHandlerMiddleware = require('./middleware/error-handler');

// middleware
app.use(express.static('./public'))
app.use(express.json())
app.use(express.static('./public'));
app.use(express.json());

app.use('/api/v1', mainRouter)
app.use('/api/v1', mainRouter);

app.use(notFoundMiddleware)
app.use(errorHandlerMiddleware)
app.use(notFoundMiddleware);
app.use(errorHandlerMiddleware);

const port = process.env.PORT || 5000
const port = process.env.PORT || 5000;

const start = async () => {
try {
app.listen(port, console.log(`Server is listening on port ${port}...`))
app.listen(port, () =>
console.log(`Server is listening on port ${port}...`)
);
} catch (error) {
console.log(error)
console.log(error);
}
}
};

start()
start();
32 changes: 17 additions & 15 deletions 05-JWT-Basics/starter/app.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
require('dotenv').config()
require('express-async-errors')
require('dotenv').config();
require('express-async-errors');

const express = require('express')
const app = express()
const express = require('express');
const app = express();

const notFoundMiddleware = require('./middleware/not-found')
const errorHandlerMiddleware = require('./middleware/error-handler')
const notFoundMiddleware = require('./middleware/not-found');
const errorHandlerMiddleware = require('./middleware/error-handler');

// middleware
app.use(express.static('./public'))
app.use(express.json())
app.use(express.static('./public'));
app.use(express.json());

app.use(notFoundMiddleware)
app.use(errorHandlerMiddleware)
app.use(notFoundMiddleware);
app.use(errorHandlerMiddleware);

const port = process.env.PORT || 3000
const port = process.env.PORT || 3000;

const start = async () => {
try {
app.listen(port, console.log(`Server is listening on port ${port}...`))
app.listen(port, () =>
console.log(`Server is listening on port ${port}...`)
);
} catch (error) {
console.log(error)
console.log(error);
}
}
};

start()
start();
4 changes: 3 additions & 1 deletion 06-jobs-api/final/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ const port = process.env.PORT || 5000;
const start = async () => {
try {
await connectDB(process.env.MONGO_URI);
app.listen(port, console.log(`Server is listening on port ${port}...`));
app.listen(port, () =>
console.log(`Server is listening on port ${port}...`)
);
} catch (error) {
console.log(error);
}
Expand Down
34 changes: 18 additions & 16 deletions 06-jobs-api/starter/app.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
require('dotenv').config()< 9E88 /span>
require('express-async-errors')
const express = require('express')
const app = express()
require('dotenv').config();
require('express-async-errors');
const express = require('express');
const app = express();

// error handler
const notFoundMiddleware = require('./middleware/not-found')
const errorHandlerMiddleware = require('./middleware/error-handler')
const notFoundMiddleware = require('./middleware/not-found');
const errorHandlerMiddleware = require('./middleware/error-handler');

app.use(express.json())
app.use(express.json());
// extra packages

// routes
app.get('/', (req, res) => {
res.send('jobs api')
})
res.send('jobs api');
});

app.use(notFoundMiddleware)
app.use(errorHandlerMiddleware)
app.use(notFoundMiddleware);
app.use(errorHandlerMiddleware);

const port = process.env.PORT || 3000
const port = process.env.PORT || 3000;

const start = async () => {
try {
app.listen(port, console.log(`Server is listening on port ${port}...`))
app.listen(port, () =>
console.log(`Server is listening on port ${port}...`)
);
} catch (error) {
console.log(error)
console.log(error);
}
}
};

start()
start();
4 changes: 3 additions & 1 deletion 07-file-upload/final/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ const port = process.env.PORT || 5000;
const start = async () => {
try {
await connectDB(process.env.MONGO_URI);
app.listen(port, console.log(`Server is listening on port ${port}...`));
app.listen(port, () =>
console.log(`Server is listening on port ${port}...`)
);
} catch (error) {
console.log(error);
}
Expand Down
4 changes: 3 additions & 1 deletion 07-file-upload/starter/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ const port = process.env.PORT || 3000;

const start = async () => {
try {
app.listen(port, console.log(`Server is listening on port ${port}...`));
app.listen(port, () =>
console.log(`Server is listening on port ${port}...`)
);
} catch (error) {
console.log(error);
}
Expand Down
4 changes: 3 additions & 1 deletion 08-send-email/final/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const port = process.env.PORT || 3000;

const start = async () => {
try {
app.listen(port, console.log(`Server is listening on port ${port}...`));
app.listen(port, () =>
console.log(`Server is listening on port ${port}...`)
);
} catch (error) {
console.log(error);
}
Expand Down
4 changes: 3 additions & 1 deletion 08-send-email/starter/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ const port = process.env.PORT || 3000;

const start = async () => {
try {
app.listen(port, console.log(`Server is listening on port ${port}...`));
app.listen(port, () =>
console.log(`Server is listening on port ${port}...`)
);
} catch (error) {
console.log(error);
}
Expand Down
4 changes: 3 additions & 1 deletion 09-stripe-payment/final/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ const port = process.env.PORT || 5000;

const start = async () => {
try {
app.listen(port, console.log(`Server is listening on port ${port}...`));
app.listen(port, () =>
console.log(`Server is listening on port ${port}...`)
);
} catch (error) {
console.log(error);
}
Expand Down
4 changes: 3 additions & 1 deletion 09-stripe-payment/starter/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const port = process.env.PORT || 3000;

const start = async () => {
try {
app.listen(port, console.log(`Server is listening on port ${port}...`));
app.listen(port, () =>
console.log(`Server is listening on port ${port}...`)
);
} catch (error) {
console.log(error);
}
Expand Down
Loading

0 comments on commit dda4cf9

Please sign in to comment.
0