some api calls functioning as intended
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
const passportLoader = require('./passport');
|
||||
const expressLoader = require('./express');
|
||||
const routes = require('../routes/API');
|
||||
const swagger = require('./swagger');
|
||||
|
||||
module.exports = async (app) => {
|
||||
const express = await expressLoader(app);
|
||||
const passport = await passportLoader(express);
|
||||
await routes(app, passport);
|
||||
await swagger(app);
|
||||
|
||||
console.log('loaders called');
|
||||
}
|
||||
@@ -4,7 +4,7 @@ const LocalStrategy = require('passport-local').Strategy;
|
||||
const AuthService = require('../services/AuthService');
|
||||
const AuthInstance = new AuthService();
|
||||
|
||||
module.exports = (app) => {
|
||||
module.exports = async (app) => {
|
||||
app.use(passport.initialize());
|
||||
app.use(passport.session());
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// Loading via yml.safeLoad to avoid errors with special characters during processing
|
||||
const swaggerDocument = yaml.safeLoad(fs.readFileSync(path.resolve(__dirname, '../swagger.yml'), 'utf8'));
|
||||
const swaggerDocument = yaml.load(fs.readFileSync(path.resolve(__dirname, '../swagger.yml'), 'utf8'));
|
||||
|
||||
const app = require('../server');
|
||||
|
||||
app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(swaggerDocument));
|
||||
module.exports = async (app) => {
|
||||
app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(swaggerDocument));
|
||||
}
|
||||
@@ -5,7 +5,7 @@ const PORT = process.env.PORT || 8088;
|
||||
|
||||
async function start() {
|
||||
const app = express();
|
||||
loaders(app);
|
||||
await loaders(app);
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Listening on port ${PORT}`);
|
||||
|
||||
@@ -19,7 +19,7 @@ module.exports = class CartService {
|
||||
|
||||
async addItem(userid, item) {
|
||||
const cart = await CartInstance.findOneByUserId(userid);
|
||||
const item = await CartProductInstance.create(item);
|
||||
const newItem = await CartProductInstance.create(item);
|
||||
}
|
||||
|
||||
async removeItem(userid, item) {
|
||||
|
||||
0
swagger.yml
Normal file
0
swagger.yml
Normal file
Reference in New Issue
Block a user