Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jim3/express-mongodb-using-native-nodejs-driver
Uses MongoDB's native Node.js driver instead of an ODM
https://github.com/jim3/express-mongodb-using-native-nodejs-driver
crud express-js mongodb-atlas node-js restful-api
Last synced: 2 days ago
JSON representation
Uses MongoDB's native Node.js driver instead of an ODM
- Host: GitHub
- URL: https://github.com/jim3/express-mongodb-using-native-nodejs-driver
- Owner: jim3
- Created: 2023-02-22T22:45:01.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-21T14:26:57.000Z (almost 2 years ago)
- Last Synced: 2024-12-17T13:11:34.486Z (about 2 months ago)
- Topics: crud, express-js, mongodb-atlas, node-js, restful-api
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## CRUD RESTful API
First "go" at a RESTful API using Node and Express. I opted out of using Mongoose and instead used MongoDB Node.js native driver, just to see the difference.
### Tech Stack
Node.js
Express.js
MongoDB Atlas### Installation
---
To install this project, clone the repository and run `npm install` to install the dependencies.
MongoDB Atlas was used for the database, so if you are using Atlas you will need to create a cluster and add the connection
string to the `.env` file. You can also use a local MongoDB instance, just change the connection string in the `.env` file.### Usage
---
To run the project, run `npm start` and the server will start on port 3000. You can change the port by setting the
`PORT` environment variable.### API
The API is built using the RESTful architecture. The API has the following endpoints:
| Method | URL | Action |
| ------ | --------- | ---------------- |
| GET | / | Get API info |
| GET | /item | List all items |
| POST | /item | Create a item |
| GET | /item/:id | Get a item |
| PUT | /item/:id | Update a item |
| DELETE | /item/:id | Delete a item |
| DELETE | /item | Delete all items |