$ npm init -y
$ npm i express express-graphql graphql mongoose cors colors
$ npm I -D nodemon dotenv
{
"scripts": {| const mongoose = require('mongoose'); | |
| const ClientSchema = new mongoose.Schema({ | |
| name: { | |
| type:String, | |
| }, | |
| email : { | |
| type: String, | |
| }, | |
| phone: { | |
| type: String, |
| const mongoose = require('mongoose'); | |
| const connectDB = async () => { | |
| const conn = await mongoose.connect(process.env.MONGODB_URL); | |
| console.log(`MongoDB connected: ${conn.connection.host}`.cyan.underline.bold); | |
| }; | |
| module.exports = connectDB; |
| // Client Type | |
| const ClientType = new GraphQLObjectType({ | |
| name: 'Client', | |
| fields: () =>({ | |
| id: {type: GraphQLID}, | |
| name: {type: GraphQLString}, | |
| email: {type: GraphQLString}, | |
| phone: {type: GraphQLString}, | |
| }) | |
| }); |
| const ProjectType = new GraphQLObjectType({ | |
| name: 'Prject', | |
| fields: () =>({ | |
| id: {type: GraphQLID}, | |
| name: {type: GraphQLString}, | |
| description: {type: GraphQLString}, | |
| status: {type: GraphQLString}, | |
| client: { | |
| type: ClientType, | |
| resolve(parent,args) { return clients.find(client => client.id === parent.clientId); } |
| const RootQuery = new GraphQLObjectType({ | |
| name: 'RootQueryType', | |
| fields: { | |
| client: { | |
| type:ClientType, | |
| args: {id:{type:GraphQLID}}, | |
| resolve(parent,args) { return clients.find(client => client.id === args.id); } | |
| } | |
| } | |
| }) |
| const RootQuery = new GraphQLObjectType({ | |
| name: 'RootQueryType', | |
| fields: { | |
| clients: { | |
| type: new GraphQLList(ClientType), | |
| resolve(parent,args) { return clients;} | |
| }, | |
| } | |
| }) |
| import { useState } from 'react' | |
| import './Header.scss' | |
| import {Link} from 'react-router-dom'; | |
| import {fetchAsyncMovies} from '../../features/movies/movieSlice'; | |
| import {useDispatch} from 'react-redux'; | |
| export default function Header() { | |
| const [keyword,setKeyword] = useState(''); | |
| const dispatch = useDispatch(); |
| import './App.scss'; | |
| import Header from './components/Header/Header'; | |
| import Footer from './components/Footer/Footer'; | |
| import Home from './components/Home/Home'; | |
| import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; | |
| import MovieDetail from './components/MovieDetail/MovieDetail'; | |
| function App() { | |
| return ( | |
| <Router> |
| for /l %i in (1,2,10) do echo %i | |
| for %name in (A B C D E F) do echo %name | |
| for /f %%url in (download.lst) do (git clone %%url) |