Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cudi7/node.js_rest-api
REST API with Node, Express, EJS and MongoDB (GET, POST, PATCH, DELETE)
https://github.com/cudi7/node.js_rest-api
ejs express mongodb nodejs rest-api
Last synced: 28 days ago
JSON representation
REST API with Node, Express, EJS and MongoDB (GET, POST, PATCH, DELETE)
- Host: GitHub
- URL: https://github.com/cudi7/node.js_rest-api
- Owner: Cudi7
- Created: 2021-04-30T13:41:08.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-30T18:23:26.000Z (almost 4 years ago)
- Last Synced: 2024-11-11T16:20:49.633Z (3 months ago)
- Topics: ejs, express, mongodb, nodejs, rest-api
- Language: EJS
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NodeJS, Express, MongoDB REST API
> REST API with Node, Express, EJS and MongoDB (GET, POST, PATCH, DELETE)
>
# Live demo>https://rest-api-rc.herokuapp.com/
## Table of contents
- [General info](#general-info)
- [Code Examples](#code-examples)
- [Features](#features)
- [Contact](#contact)## General info
Following my desire to learn more about back-end technologies I completed what I believed was the entry point of any full stack developer, a REST API.
I created something fundamental and quick (even though it took a while) that I could do to practice node by itself, so later, I can integrate full applications using React## Code Examples
```
import express from 'express';
import dotenv from 'dotenv';
import methodOverride from 'method-override';import connectDB from './config/db.js';
import indexRoute from './routes/indexRoute.js';
import registerRoute from './routes/registerRoute.js';
import logoutRoute from './routes/logoutRoute.js';
import usersRoute from './routes/usersRoute.js';
import profileRoute from './routes/profileRoute.js';dotenv.config({ path: './config/.env' });
const app = express();
connectDB();app.set('views', './mvc/views');
const PORT = process.env.PORT || 5001;
app.use(express.json());
app.use(express.urlencoded({ extended: true }));app.use(methodOverride('_method'));
app.use('/', indexRoute);
app.use('/users', usersRoute);
app.use('/register', registerRoute);
app.use('/profile', profileRoute);
app.use('/logout', logoutRoute);app.listen(PORT, () => {
console.log(`App running on port ${PORT}`);
});global.userInfo = undefined;
```## Features
User can:
- Register (we will check if the e-mail is already in use)
- Login (we will check if the e-mail exists or/and if the password is correct)
- Logout
- Delete Profile
- Update Profile
- Get a list of all the users info
- Get a single user info## Technology used
The project is created with:
- node
- express
- dotenv,
- nodemon,
- bcrypt,
- ejs,
- mongodb
- mongoose,
- method-override## Contact
Created by Cudi - feel free to contact me!