A express.js based API project kit.
git clone https://github.com/oppytut/express-api-kit.git && cd express-api-kit
npm install
For development mode with Webpack watch:
npm run dev
For production mode:
npm run start
Access http://localhost:8000 through the browser
The configuration files are in the configs directory.
const username = 'mz_petuahUser';
const password = 'sandimz_petuahUser';
const host = '127.0.0.1';
const port = '17027';
const name = 'mz_petuah';
A name
variable for database name.
Server port can be configured.
const port = 8000;
Clients that can access the API can be configured.
const whiteList = ['http://localhost:3000'];
const corsOptions = (req, cb) => {
const options = {
origin: whiteList.indexOf(req.header('Origin')) !== -1,
optionsSuccessStatus: 200,
methods: ['GET', 'POST', 'PUT', 'DELETE'],
};
cb(null, options);
};
JWT secret code can be configured.
const jwtConfig = {
secret: 'g0r3ng4nH4ng4t',
};
Bcrypt salt rounds can be configured.
const bcryptConfig = {
saltRounds: 10,
};
A demo can be accessed on https://exa.mazovi.com/api/ ... (GET/POST/PUT/DELETE)
.
- Configure Git, NPM, and Eslint (airbnb)
- Add and Configure Webpack (auto reload)
- Add GraphQL and Apollo Server
- Add Redis
- Publish helpers to NPM
- Testing