This is a sample API runs in the Node.js environment and it's used as a supplementary asset in this application. It uses the Express.js framework and pulls data from a MongoDB Atlas database.
- Test if server is running - /api/utils/hello
- Test if you can connect to DB - /api/utils/is-mongoose-connected
Before you can run the app with npm start
you should install all depedencies (this means also that you have installed Node.js and npm on your machine. Learn how by reading the docs on downloading and installing Node.js and npm). To begin, navigate on the project directory, after you have downloaded or cloned this repository and run:
Then, while in the project directory, you can run:
Runs the app.js (where the server logic lives) Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits, as it runs the nodemon task. You will also see any errors in the console.
Runs the app.js app (where the server logic lives) Open http://localhost:3000 to view it in the browser.
- In order to connect to your database you need a MongoDB Atlas account. Refer to this documentation on getting started with MongoDB Atlas.
- Rename the .env.sample.txt to .env and input the MONGO_URI string to your specific database. Input your own sample data. The schema is already supplied in the source code, in the models/movies.js
- cors
- dotenv
- express
- mongoose
- nodemon
If you spot any bugs, would like to show me how to make better, or just say hi, contact me at elissavet.me. Thank you!