在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:davellanedam/node-express-mongodb-jwt-rest-api-skeleton开源软件地址:https://github.com/davellanedam/node-express-mongodb-jwt-rest-api-skeleton开源编程语言:JavaScript 99.2%开源软件介绍:Node.js express.js MongoDB JWT REST API - Basic Project SkeletonGetting startedThis 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) This project is created to help other developers create a basic REST API in an easy way with Node.js. This basic example shows how powerful and simple JavaScript can be. Do you want to contribute? Pull requests are always welcome to show more features. Buy me a coffeeHi! I'm Daniel Avellaneda, I'm an open source enthusiast and devote my free time to building projects in this field. I'm the creator and maintainer of node-express-mongodb-jwt-rest-api-skeleton and vue-skeleton-mvp These projects are a "starter web app kit" for any developer who wants to build their own app without starting from scratch: API + Frontend Both projects have been downloaded thousands of times by web developers around the world. I'm doing my best to provide you a good experience when using my apps, so if you like what I'm doing and wish to say "thanks!", please buy me a coffee Feel free to send me a tweet https://twitter.com/davellanedam, share this with others or make a pull request Features
Requirements
DemoA demo of this API is located at: https://api-demo.daniel-avellaneda.com Login credentialsemail: IMPORTANT: Database resets every 30 mins like "12:00am, 12:30am, 1:00am" and so on. So anything you do with the API will be lost after a short time. API documentation Demo is also linked to a VueJS project that shows how this API can be integrated to a frontend that is able to consume an API. How to installUsing Git (recommended)
git clone https://github.com/davellanedam/node-express-mongodb-jwt-rest-api-skeleton.git ./myproject Using manual download ZIP
Install npm dependencies after installing (Git or manual download)cd myproject
npm install
npm update Setting up environments (development or production)
IMPORTANT: By default token expires in 3 days (4320 minutes set in .env.example). You can refresh token at endpoint GET /token. If everything it´s ok you will get a new token. MailerTo ensure the deliverability of emails sent by this API, If you want to try a different method it´s ok, I used https://nodemailer.com for this API and they have different transport methods like: smtp. i18nLanguage is automatically detected from How to runDatabase cleaning and seeding samplesThere are 3 available commands for this: npm run command
Running in development mode (lifting API server)npm run dev You will know server is running by checking the output of the command ****************************
* Starting Server
* Port: 3000
* NODE_ENV: development
* Database: MongoDB
* DB Connection: OK
**************************** Running testsIt´s a good practice to do tests at your code, so a sample of how to do that in npm run test Formatting codeFormat your code with prettier by typing: npm run format Formatting markdown filesFormat all your markdown files with remark by typing: npm run remark Linting codeLint your code with ESLint by typing: npm run lint UsageOnce everything is set up to test API routes either use Postman or any other api testing application. Default username/password combination for login is API documentationhttps://documenter.getpostman.com/view/487539/RWaHwoLV Postman API example collectionYou can import the example collection to Postman. To import, click the import button located and select Go to
This is a REST API, so it works using the following HTTP methods:
Creating new modelsIf you need to add more models to the project just create a new file in Creating new routesIf you need to add more routes to the project just create a new file in Creating new controllersWhen you create a new controller, try to also create another folder with validations and helpers. Ex. Bugs or improvementsFeel free to report any bugs or improvements. Pull requests are always welcome. LicenseThis project is open-sourced software licensed under the MIT License. See the LICENSE file for more information. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论