This project is based on the remult tutorial Todo App with React and saves all the work of doing the step by step setup.
Simply open a command line and run the following commands to setup:
git clone https://github.com/remult/remult-react-todo.git
cd remult-react-todo
npm i
Once it's done, open two terminals to run:
- The api server
npm run dev-node
- The React dev cli
npm run dev-react
And proceed to the Entities section of the tutorials
You can see the diff using github compare
npm i graphql express-graphql swagger-ui-express
npm i --save-dev @types/swagger-ui-express
And replace index.ts with:
import express from 'express';
import swaggerUi from 'swagger-ui-express';
import { buildSchema } from 'graphql';
import { graphqlHTTP } from 'express-graphql';
import { remultGraphql } from 'remult/graphql';
import { remultExpress } from 'remult/remult-express';
let app = express();
let api = remultExpress();
app.use(api);
app.use('/api/docs', swaggerUi.serve,
swaggerUi.setup(api.openApiDoc({ title: 'remult-react-todo' })));
const { schema, rootValue } = remultGraphql(api);
app.use('/api/graphql', graphqlHTTP({
schema: buildSchema(schema),
rootValue,
graphiql: true,
}));
app.listen(3002, () => console.log("Server started"));