mirror of
https://github.com/IT4Change/boilerplate-backend.git
synced 2025-12-13 10:25:49 +00:00
add prettier
This commit is contained in:
parent
c7d1ed4adc
commit
98896a653d
14
.prettierrc.json
Normal file
14
.prettierrc.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"printWidth": 100,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"quoteProps": "as-needed",
|
||||||
|
"jsxSingleQuote": true,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"bracketSameLine": false,
|
||||||
|
"arrowParens": "always",
|
||||||
|
"endOfLine": "auto"
|
||||||
|
}
|
||||||
30
src/index.ts
30
src/index.ts
@ -1,41 +1,41 @@
|
|||||||
import { ApolloServer, gql } from "apollo-server-express";
|
import { ApolloServer, gql } from 'apollo-server-express'
|
||||||
import express from "express";
|
import express from 'express'
|
||||||
|
|
||||||
const typeDefs = gql`
|
const typeDefs = gql`
|
||||||
type Query {
|
type Query {
|
||||||
hello: String
|
hello: String
|
||||||
}
|
}
|
||||||
`;
|
`
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
Query: {
|
Query: {
|
||||||
hello: () => "Hello world!",
|
hello: () => 'Hello world!',
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
|
|
||||||
async function listen(port: number) {
|
async function listen(port: number) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const app: any = express();
|
const app: any = express()
|
||||||
|
|
||||||
const server = new ApolloServer({
|
const server = new ApolloServer({
|
||||||
typeDefs,
|
typeDefs,
|
||||||
resolvers,
|
resolvers,
|
||||||
});
|
})
|
||||||
await server.start();
|
await server.start()
|
||||||
|
|
||||||
server.applyMiddleware({ app, path: "/" });
|
server.applyMiddleware({ app, path: '/' })
|
||||||
|
|
||||||
return app.listen(port);
|
return app.listen(port)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
await listen(4000);
|
await listen(4000)
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log("🚀 Server is ready at http://localhost:4000/graphql");
|
console.log('🚀 Server is ready at http://localhost:4000/graphql')
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch((e) => {
|
main().catch((e) => {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error(e);
|
console.error(e)
|
||||||
throw e;
|
throw e
|
||||||
});
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user