This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (!user) { | |
| return ( | |
| <View style={styles.container}> | |
| <TextInput | |
| style={styles.input} | |
| placeholder='Enter your name' | |
| value={name} | |
| onChangeText={setName} | |
| /> | |
| <Button onPress={handlePress} title='💬 Enter chat room' /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const mongoose = require('mongoose'); | |
| const cors = require('cors'); | |
| const bodyParser = require('body-parser'); | |
| require('dotenv/config'); | |
| const app = express(); | |
| app.use(cors()) | |
| app.use(bodyParser.json()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const mongoose = require('mongoose'); | |
| const UserSchema = mongoose.Schema({ | |
| name: { | |
| type: String, | |
| required: true, | |
| min: 6, | |
| max: 255 | |
| }, | |
| email: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const mongoose = require('mongoose'); | |
| const PostSchema = mongoose.Schema({ | |
| userID: { | |
| type: String | |
| }, | |
| title: { | |
| type: String, | |
| required: true | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Joi = require('joi'); | |
| const registerValidation = data => { | |
| const RegistrationSchema = Joi.object({ | |
| name: Joi.string().min(6).required(), | |
| email: Joi.string().min(6).required().email(), | |
| password: Joi.string().min(6).required() | |
| }); | |
| return RegistrationSchema.validate(data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const bcrypt = require('bcryptjs'); | |
| const jwt = require('jsonwebtoken'); | |
| const router = express.Router(); | |
| // MongoDB Model | |
| const User = require('../models/User'); | |
| const Post = require('../models/Post'); | |
| // VALIDATION Import |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const router = express.Router(); | |
| const Post = require('../models/Post'); | |
| // Create A post for specific user - Create | |
| router.post('/:uid', async (req, res) => { | |
| const post = new Post({ | |
| userID: req.params.uid, | |
| title: req.body.title, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import { | |
| StyleSheet, | |
| View, | |
| Text, | |
| ScrollView, | |
| TouchableOpacity, | |
| SafeAreaView, | |
| KeyboardAvoidingView, | |
| } from 'react-native'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'react-native-gesture-handler'; | |
| import React from 'react'; | |
| import { NavigationContainer } from '@react-navigation/native'; | |
| import { createStackNavigator } from '@react-navigation/stack'; | |
| import SplashScreen from './src/screens/SplashScreen'; | |
| import LoginScreen from './src/screens/LoginScreen'; | |
| import RegisterScreen from './src/screens/RegisterScreen'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from "react"; | |
| import { | |
| StyleSheet, | |
| Text, | |
| TouchableOpacity, | |
| ScrollView, | |
| View, | |
| Image | |
| } from "react-native"; |