![]() In the directory server we now create the file in the subdirectory called routes:Ĭonst express = require ( ' express ' ) const bodyParser = require ( ' body-parser ' ) const http = require ( ' http ' ) const mongoose = require ( ' mongoose ' ) const dbConfig = require ( '. This will contain all controllers, models and routes. We have already created the directory server. ![]() However, nodemon should only be used in development. ![]() It waits for changes in the code and restarts the server automatically. “nodemon” is a useful tool to show live changes. It also allows us to interact with the database. “mongoose” is in object modeling tool for MongoDB. “body-parser” is a middleware application and parses the request body. Npm install express body-parser mongoose nodemon -saveĪs already mentioned, “express” is our web framework for the server. It also contains the metadata of the project, like the name or version.įor the server we still need some dependencies. This file manages all local npm packages needed for the project. With this command we create a package.json file. To initialize the server, we create a new folder called server in the root directory.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |