UNPKG

node-express-mongodb-jwt-rest-api-skeleton

Version:

Node.js express.js MongoDB JWT REST API - This is a basic API REST skeleton written on JavaScript using async/await. Great for building a starter web API for your front-end (Android, iOS, Vue, react, angular, or anything that can consume an API)

24 lines (21 loc) 538 B
require('dotenv-safe').config() const { Seeder } = require('mongo-seeding') const path = require('path') const config = { database: process.env.MONGO_URI, inputPath: path.resolve(__dirname, './data'), dropDatabase: false } const seeder = new Seeder(config) const collections = seeder.readCollectionsFromPath(path.resolve('./data')) const main = async () => { try { await seeder.import(collections) console.log('Seed complete!') process.exit(0) } catch (err) { console.log(err) process.exit(0) } } main()