Skip to content

Commit c669d33

Browse files
committed
Remove gulp. Replace imports with require. No transpilation required now.
1 parent e9390f5 commit c669d33

18 files changed

+102
-1103
lines changed

config/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Joi from 'joi';
1+
const Joi = require('joi');
22

33
// require and configure dotenv, will load vars in .env in PROCESS.ENV
44
require('dotenv').config();
@@ -41,4 +41,4 @@ const config = {
4141
}
4242
};
4343

44-
export default config;
44+
module.exports = config;

config/express.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import express from 'express';
2-
import logger from 'morgan';
3-
import bodyParser from 'body-parser';
4-
import cookieParser from 'cookie-parser';
5-
import compress from 'compression';
6-
import methodOverride from 'method-override';
7-
import cors from 'cors';
8-
import httpStatus from 'http-status';
9-
import expressWinston from 'express-winston';
10-
import expressValidation from 'express-validation';
11-
import helmet from 'helmet';
12-
import winstonInstance from './winston';
13-
import routes from '../index.route';
14-
import config from './config';
15-
import APIError from '../server/helpers/APIError';
1+
const express = require('express');
2+
const logger = require('morgan');
3+
const bodyParser = require('body-parser');
4+
const cookieParser = require('cookie-parser');
5+
const compress = require('compression');
6+
const methodOverride = require('method-override');
7+
const cors = require('cors');
8+
const httpStatus = require('http-status');
9+
const expressWinston = require('express-winston');
10+
const expressValidation = require('express-validation');
11+
const helmet = require('helmet');
12+
const winstonInstance = require('./winston');
13+
const routes = require('../index.route');
14+
const config = require('./config');
15+
const APIError = require('../server/helpers/APIError');
1616

1717
const app = express();
1818

@@ -84,4 +84,4 @@ app.use((err, req, res, next) => // eslint-disable-line no-unused-vars
8484
})
8585
);
8686

87-
export default app;
87+
module.exports = app;

config/param-validation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import Joi from 'joi';
1+
const Joi = require('joi');
22

3-
export default {
3+
module.exports = {
44
// POST /api/users
55
createUser: {
66
body: {

config/winston.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import winston from 'winston';
1+
const winston = require('winston');
22

33
const logger = new (winston.Logger)({
44
transports: [
@@ -9,4 +9,4 @@ const logger = new (winston.Logger)({
99
]
1010
});
1111

12-
export default logger;
12+
module.exports = logger;

gulpfile.babel.js

Lines changed: 0 additions & 60 deletions
This file was deleted.

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import mongoose from 'mongoose';
2-
import util from 'util';
1+
const mongoose = require('mongoose');
2+
const util = require('util');
33

44
// config should be imported before importing any other file
5-
import config from './config/config';
6-
import app from './config/express';
5+
const config = require('./config/config');
6+
const app = require('./config/express');
77

88
const debug = require('debug')('express-mongoose-es6-rest-api:index');
99

@@ -36,4 +36,4 @@ if (!module.parent) {
3636
});
3737
}
3838

39-
export default app;
39+
module.exports = app;

index.route.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import express from 'express';
2-
import userRoutes from './server/user/user.route';
3-
import authRoutes from './server/auth/auth.route';
1+
const express = require('express');
2+
const userRoutes = require('./server/user/user.route');
3+
const authRoutes = require('./server/auth/auth.route');
44

55
const router = express.Router(); // eslint-disable-line new-cap
66

@@ -17,4 +17,4 @@ router.use('/users', userRoutes);
1717
// mount auth routes at /auth
1818
router.use('/auth', authRoutes);
1919

20-
export default router;
20+
module.exports = router;

package.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
"yarn": ">=0.27.5"
1212
},
1313
"scripts": {
14-
"start": "gulp serve",
14+
"start": "node index.js",
1515
"start:debug": "cross-env DEBUG=express-mongoose-es6-rest-api:* yarn start",
16-
"build": "gulp",
1716
"lint": "esw *.js server config --color",
1817
"lint:watch": "yarn lint -- --watch",
1918
"precommit": "yarn lint && yarn test",
@@ -72,22 +71,13 @@
7271
"coveralls": "^2.11.6",
7372
"cross-env": "3.1.3",
7473
"cz-conventional-changelog": "1.2.0",
75-
"del": "^2.2.0",
7674
"eslint": "3.16.1",
7775
"eslint-config-airbnb-base": "7.1.0",
7876
"eslint-plugin-import": "1.16.0",
7977
"eslint-watch": "2.1.14",
80-
"gulp": "3.9.1",
81-
"gulp-babel": "6.1.2",
82-
"gulp-load-plugins": "^1.2.0",
83-
"gulp-newer": "^1.1.0",
84-
"gulp-nodemon": "^2.0.6",
85-
"gulp-sourcemaps": "^1.6.0",
86-
"gulp-util": "^3.0.7",
8778
"husky": "^0.13.1",
8879
"istanbul": "1.1.0-alpha.1",
8980
"mocha": "3.2.0",
90-
"run-sequence": "^1.1.5",
9181
"supertest": "2.0.1",
9282
"supertest-as-promised": "4.0.2",
9383
"validate-commit-msg": "^2.6.1"

server/auth/auth.controller.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import jwt from 'jsonwebtoken';
2-
import httpStatus from 'http-status';
3-
import APIError from '../helpers/APIError';
4-
import config from '../../config/config';
1+
const jwt = require('jsonwebtoken');
2+
const httpStatus = require('http-status');
3+
const APIError = require('../helpers/APIError');
4+
const config = require('../../config/config');
55

66
// sample user, used for authentication
77
const user = {
@@ -47,4 +47,4 @@ function getRandomNumber(req, res) {
4747
});
4848
}
4949

50-
export default { login, getRandomNumber };
50+
module.exports = { login, getRandomNumber };

server/auth/auth.route.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import express from 'express';
2-
import validate from 'express-validation';
3-
import expressJwt from 'express-jwt';
4-
import paramValidation from '../../config/param-validation';
5-
import authCtrl from './auth.controller';
6-
import config from '../../config/config';
1+
const express = require('express');
2+
const validate = require('express-validation');
3+
const expressJwt = require('express-jwt');
4+
const paramValidation = require('../../config/param-validation');
5+
const authCtrl = require('./auth.controller');
6+
const config = require('../../config/config');
77

88
const router = express.Router(); // eslint-disable-line new-cap
99

@@ -16,4 +16,4 @@ router.route('/login')
1616
router.route('/random-number')
1717
.get(expressJwt({ secret: config.jwtSecret }), authCtrl.getRandomNumber);
1818

19-
export default router;
19+
module.exports = router;

0 commit comments

Comments
 (0)